{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Advection using the k-Scheme\n",
    "## CH EN 6355 - Computational Fluid Dynamics\n",
    "**Prof. Tony Saad (<a>www.tsaad.net</a>) <br/>\n",
    "slides at: <a>www.tsaad.net</a><br/>\n",
    "Department of Chemical Engineering <br/>\n",
    "University of Utah**\n",
    "<hr/>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Here, we will implement the k-scheme or kappa-schemes for advection. It is easiest to implement this scheme since for different values of k, we recover all sorts of high-order flux approximations. We will assume a positive advecting velocity for illustration purposes.\n",
    "\n",
    "We are solving the constant speed advection equation given by\n",
    "\\begin{equation}\n",
    "u_t = - c u_x = - F_x;\\quad F = cu\n",
    "\\end{equation}\n",
    "We will use a simple Forward Euler explicit method. Using a finite volume integration, we get\n",
    "\\begin{equation}\n",
    "u_i^{n+1} = u_i^n - \\frac{\\Delta t}{\\Delta x} (F_{i+\\tfrac{1}{2}}^n - F_{i-\\tfrac{1}{2}}^n)\n",
    "\\end{equation}\n",
    "For constant grid spacing, the k-Scheme is given by\n",
    "\\begin{equation}\n",
    "{\\phi _f} = {\\phi _{\\rm{C}}} + \\frac{{1 - k}}{4}({\\phi _{\\rm{C}}} - {\\phi _{\\rm{U}}}) + \\frac{{1 + k}}{4}({\\phi _{\\rm{D}}} - {\\phi _{\\rm{C}}})\n",
    "\\end{equation}\n",
    "which, for a positive advecting velocity, gives us\n",
    "\\begin{equation}\n",
    "F_{i + {\\textstyle{1 \\over 2}}}^n = c\\phi _{i + {\\textstyle{1 \\over 2}}}^n = c{\\phi _i} + c\\frac{{1 - k}}{4}({\\phi _i} - {\\phi _{i - 1}}) + c\\frac{{1 + k}}{4}({\\phi _{i + 1}} - {\\phi _i})\n",
    "\\end{equation}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "%matplotlib inline\n",
    "%config InlineBackend.figure_format = 'svg'\n",
    "import matplotlib.pyplot as plt\n",
    "import matplotlib.animation as animation\n",
    "plt.rcParams['animation.html'] = 'html5'\n",
    "from matplotlib import cm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "def step(x,x0):\n",
    "    x0 = 0.6\n",
    "    x1 = 0.8\n",
    "    result = x - x0\n",
    "    result[x-x1<x1] = 1.0            \n",
    "    result[x<x0] = 0.0\n",
    "    result[x>x1] = 0.0  \n",
    "    return result\n",
    "\n",
    "def gaussian(x,x0):\n",
    "    s = 0.08\n",
    "    s = s*s\n",
    "    result = np.exp( -(x-x0)**2/s)\n",
    "    return result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x1199f8630>]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<!-- Created with matplotlib (https://matplotlib.org/) -->\n",
       "<svg height=\"251.195677pt\" version=\"1.1\" viewBox=\"0 0 372.430079 251.195677\" width=\"372.430079pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
       " <defs>\n",
       "  <style type=\"text/css\">\n",
       "*{stroke-linecap:butt;stroke-linejoin:round;}\n",
       "  </style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 251.195677 \n",
       "L 372.430079 251.195677 \n",
       "L 372.430079 0 \n",
       "L 0 0 \n",
       "z\n",
       "\" style=\"fill:none;\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 26.930079 228.14 \n",
       "L 361.730079 228.14 \n",
       "L 361.730079 10.7 \n",
       "L 26.930079 10.7 \n",
       "z\n",
       "\" style=\"fill:#ffffff;\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\">\n",
       "      <defs>\n",
       "       <path d=\"M 0 0 \n",
       "L 0 3.5 \n",
       "\" id=\"m5e582b2dd6\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"45.633341\" xlink:href=\"#m5e582b2dd6\" y=\"228.14\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_1\">\n",
       "      <!-- $0.0$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 42 31.84375 \n",
       "C 42 37.96875 41.90625 48.421875 37.703125 56.453125 \n",
       "C 34 63.484375 28.09375 66 22.90625 66 \n",
       "C 18.09375 66 12 63.78125 8.203125 56.5625 \n",
       "C 4.203125 49.015625 3.796875 39.671875 3.796875 31.84375 \n",
       "C 3.796875 26.109375 3.90625 17.375 7 9.734375 \n",
       "C 11.296875 -0.609375 19 -2 22.90625 -2 \n",
       "C 27.5 -2 34.5 -0.109375 38.59375 9.4375 \n",
       "C 41.59375 16.375 42 24.5 42 31.84375 \n",
       "z\n",
       "M 22.90625 -0.40625 \n",
       "C 16.5 -0.40625 12.703125 5.125 11.296875 12.75 \n",
       "C 10.203125 18.6875 10.203125 27.328125 10.203125 32.953125 \n",
       "C 10.203125 40.6875 10.203125 47.109375 11.5 53.234375 \n",
       "C 13.40625 61.78125 19 64.390625 22.90625 64.390625 \n",
       "C 27 64.390625 32.296875 61.671875 34.203125 53.4375 \n",
       "C 35.5 47.71875 35.59375 40.984375 35.59375 32.953125 \n",
       "C 35.59375 26.421875 35.59375 18.375 34.40625 12.453125 \n",
       "C 32.296875 1.5 26.40625 -0.40625 22.90625 -0.40625 \n",
       "z\n",
       "\" id=\"CMR17-48\"/>\n",
       "       <path d=\"M 18.40625 4.796875 \n",
       "C 18.40625 7.6875 16 9.6875 13.59375 9.6875 \n",
       "C 10.703125 9.6875 8.703125 7.296875 8.703125 4.890625 \n",
       "C 8.703125 2 11.09375 0 13.5 0 \n",
       "C 16.40625 0 18.40625 2.390625 18.40625 4.796875 \n",
       "z\n",
       "\" id=\"CMMI12-58\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(39.268301 242.058498)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_2\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"105.112036\" xlink:href=\"#m5e582b2dd6\" y=\"228.14\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_2\">\n",
       "      <!-- $0.2$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 41.703125 15.46875 \n",
       "L 39.90625 15.46875 \n",
       "C 38.90625 8.390625 38.09375 7.1875 37.703125 6.59375 \n",
       "C 37.203125 5.796875 30 5.796875 28.59375 5.796875 \n",
       "L 9.40625 5.796875 \n",
       "C 13 9.6875 20 16.765625 28.5 24.9375 \n",
       "C 34.59375 30.71875 41.703125 37.5 41.703125 47.390625 \n",
       "C 41.703125 59.1875 32.296875 66 21.796875 66 \n",
       "C 10.796875 66 4.09375 56.296875 4.09375 47.296875 \n",
       "C 4.09375 43.390625 7 42.890625 8.203125 42.890625 \n",
       "C 9.203125 42.890625 12.203125 43.484375 12.203125 46.984375 \n",
       "C 12.203125 50.09375 9.59375 51 8.203125 51 \n",
       "C 7.59375 51 7 50.890625 6.59375 50.6875 \n",
       "C 8.5 59.1875 14.296875 63.390625 20.40625 63.390625 \n",
       "C 29.09375 63.390625 34.796875 56.5 34.796875 47.390625 \n",
       "C 34.796875 38.703125 29.703125 31.21875 24 24.734375 \n",
       "L 4.09375 2.296875 \n",
       "L 4.09375 0 \n",
       "L 39.296875 0 \n",
       "z\n",
       "\" id=\"CMR17-50\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(98.746996 242.058498)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-50\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"164.590731\" xlink:href=\"#m5e582b2dd6\" y=\"228.14\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_3\">\n",
       "      <!-- $0.4$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 33.59375 64.796875 \n",
       "C 33.59375 66.890625 33.5 67 31.703125 67 \n",
       "L 2 19.59375 \n",
       "L 2 17 \n",
       "L 27.796875 17 \n",
       "L 27.796875 7.1875 \n",
       "C 27.796875 3.59375 27.59375 2.59375 20.59375 2.59375 \n",
       "L 18.703125 2.59375 \n",
       "L 18.703125 0 \n",
       "C 21.90625 0.1875 27.296875 0.1875 30.703125 0.1875 \n",
       "C 34.09375 0.1875 39.5 0.1875 42.703125 0 \n",
       "L 42.703125 2.59375 \n",
       "L 40.796875 2.59375 \n",
       "C 33.796875 2.59375 33.59375 3.59375 33.59375 7.1875 \n",
       "L 33.59375 17 \n",
       "L 43.796875 17 \n",
       "L 43.796875 19.59375 \n",
       "L 33.59375 19.59375 \n",
       "z\n",
       "M 28.09375 58.171875 \n",
       "L 28.09375 19.59375 \n",
       "L 4 19.59375 \n",
       "z\n",
       "\" id=\"CMR17-52\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(158.225692 242.058498)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-52\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_4\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"224.069427\" xlink:href=\"#m5e582b2dd6\" y=\"228.14\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_4\">\n",
       "      <!-- $0.6$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 10.59375 34.34375 \n",
       "C 10.59375 58 21.796875 63.6875 28.296875 63.6875 \n",
       "C 30.40625 63.6875 35.5 63.265625 37.5 59.09375 \n",
       "C 35.90625 59.09375 32.90625 59.09375 32.90625 55.59375 \n",
       "C 32.90625 52.890625 35.09375 52 36.5 52 \n",
       "C 37.40625 52 40.09375 52.390625 40.09375 55.796875 \n",
       "C 40.09375 62.296875 35.09375 66 28.203125 66 \n",
       "C 16.296875 66 3.796875 53.296875 3.796875 31.421875 \n",
       "C 3.796875 4.015625 15.09375 -2 23.09375 -2 \n",
       "C 32.796875 -2 42 6.734375 42 20.234375 \n",
       "C 42 32.828125 33.90625 42 23.703125 42 \n",
       "C 17.59375 42 13.09375 37.96875 10.59375 30.921875 \n",
       "z\n",
       "M 23.09375 0.390625 \n",
       "C 10.796875 0.390625 10.796875 18.9375 10.796875 22.65625 \n",
       "C 10.796875 29.90625 14.203125 40.390625 23.5 40.390625 \n",
       "C 25.203125 40.390625 30.09375 40.390625 33.40625 33.4375 \n",
       "C 35.203125 29.515625 35.203125 25.375 35.203125 20.34375 \n",
       "C 35.203125 14.90625 35.203125 10.875 33.09375 6.84375 \n",
       "C 30.90625 2.703125 27.703125 0.390625 23.09375 0.390625 \n",
       "z\n",
       "\" id=\"CMR17-54\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(217.704387 242.058498)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-54\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"283.548122\" xlink:href=\"#m5e582b2dd6\" y=\"228.14\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_5\">\n",
       "      <!-- $0.8$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 27.203125 35.765625 \n",
       "C 33.5 38.96875 39.90625 43.796875 39.90625 51.53125 \n",
       "C 39.90625 60.6875 31.09375 66 23 66 \n",
       "C 13.90625 66 5.90625 59.375 5.90625 50.234375 \n",
       "C 5.90625 47.71875 6.5 43.390625 10.40625 39.578125 \n",
       "C 11.40625 38.578125 15.59375 35.5625 18.296875 33.65625 \n",
       "C 13.796875 31.34375 3.296875 25.8125 3.296875 14.765625 \n",
       "C 3.296875 4.40625 13.09375 -2 22.796875 -2 \n",
       "C 33.5 -2 42.5 5.71875 42.5 15.96875 \n",
       "C 42.5 25.109375 36.40625 29.328125 32.40625 32.046875 \n",
       "z\n",
       "M 14.09375 44.609375 \n",
       "C 13.296875 45.109375 9.296875 48.21875 9.296875 52.9375 \n",
       "C 9.296875 59.078125 15.59375 63.6875 22.796875 63.6875 \n",
       "C 30.703125 63.6875 36.5 58.0625 36.5 51.53125 \n",
       "C 36.5 42.1875 26.09375 36.859375 25.59375 36.859375 \n",
       "C 25.5 36.859375 25.40625 36.859375 24.59375 37.46875 \n",
       "z\n",
       "M 32.5 24 \n",
       "C 34 22.90625 38.796875 19.578125 38.796875 13.453125 \n",
       "C 38.796875 6.015625 31.40625 0.390625 23 0.390625 \n",
       "C 13.90625 0.390625 7 6.921875 7 14.859375 \n",
       "C 7 22.796875 13.09375 29.4375 20 32.546875 \n",
       "z\n",
       "\" id=\"CMR17-56\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(277.183083 242.058498)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-56\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_6\">\n",
       "     <g id=\"line2d_6\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"343.026817\" xlink:href=\"#m5e582b2dd6\" y=\"228.14\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_6\">\n",
       "      <!-- $1.0$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 26.59375 63.796875 \n",
       "C 26.59375 65.890625 26.5 66 25.09375 66 \n",
       "C 21.203125 61.359375 15.296875 59.890625 9.703125 59.6875 \n",
       "C 9.40625 59.6875 8.90625 59.6875 8.796875 59.5 \n",
       "C 8.703125 59.296875 8.703125 59.09375 8.703125 57 \n",
       "C 11.796875 57 17 57.59375 21 59.984375 \n",
       "L 21 7.296875 \n",
       "C 21 3.796875 20.796875 2.59375 12.203125 2.59375 \n",
       "L 9.203125 2.59375 \n",
       "L 9.203125 0 \n",
       "C 14 0.09375 19 0.1875 23.796875 0.1875 \n",
       "C 28.59375 0.1875 33.59375 0.09375 38.40625 0 \n",
       "L 38.40625 2.59375 \n",
       "L 35.40625 2.59375 \n",
       "C 26.796875 2.59375 26.59375 3.6875 26.59375 7.296875 \n",
       "z\n",
       "\" id=\"CMR17-49\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(336.661778 242.058498)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-49\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <defs>\n",
       "       <path d=\"M 0 0 \n",
       "L -3.5 0 \n",
       "\" id=\"m3ac3098f1a\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"26.930079\" xlink:href=\"#m3ac3098f1a\" y=\"218.256364\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_7\">\n",
       "      <!-- $0.0$ -->\n",
       "      <g transform=\"translate(7.2 221.715613)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_8\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"26.930079\" xlink:href=\"#m3ac3098f1a\" y=\"178.721837\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_8\">\n",
       "      <!-- $0.2$ -->\n",
       "      <g transform=\"translate(7.2 182.181086)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-50\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_9\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"26.930079\" xlink:href=\"#m3ac3098f1a\" y=\"139.18731\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_9\">\n",
       "      <!-- $0.4$ -->\n",
       "      <g transform=\"translate(7.2 142.646559)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-52\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_10\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"26.930079\" xlink:href=\"#m3ac3098f1a\" y=\"99.652782\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_10\">\n",
       "      <!-- $0.6$ -->\n",
       "      <g transform=\"translate(7.2 103.112032)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-54\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_11\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"26.930079\" xlink:href=\"#m3ac3098f1a\" y=\"60.118255\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_11\">\n",
       "      <!-- $0.8$ -->\n",
       "      <g transform=\"translate(7.2 63.577505)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-56\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_6\">\n",
       "     <g id=\"line2d_12\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"26.930079\" xlink:href=\"#m3ac3098f1a\" y=\"20.583728\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_12\">\n",
       "      <!-- $1.0$ -->\n",
       "      <g transform=\"translate(7.2 24.042978)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-49\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_13\">\n",
       "    <path clip-path=\"url(#pfeeef92832)\" d=\"M 42.148261 218.256313 \n",
       "L 67.705513 218.187702 \n",
       "L 72.352286 218.057328 \n",
       "L 76.999059 217.721778 \n",
       "L 79.322445 217.404962 \n",
       "L 81.645832 216.926005 \n",
       "L 83.969218 216.216884 \n",
       "L 86.292605 215.188849 \n",
       "L 88.615992 213.729784 \n",
       "L 90.939378 211.702909 \n",
       "L 93.262765 208.94771 \n",
       "L 95.586151 205.283976 \n",
       "L 97.909538 200.5198 \n",
       "L 100.232924 194.464112 \n",
       "L 102.556311 186.943839 \n",
       "L 104.879697 177.825119 \n",
       "L 107.203084 167.037182 \n",
       "L 109.52647 154.596655 \n",
       "L 111.849857 140.629301 \n",
       "L 114.173243 125.385787 \n",
       "L 123.46679 61.038093 \n",
       "L 125.790176 47.274337 \n",
       "L 128.113563 35.818746 \n",
       "L 130.436949 27.273317 \n",
       "L 132.760336 22.10482 \n",
       "L 135.083722 20.602579 \n",
       "L 137.407109 22.851653 \n",
       "L 139.730495 28.724858 \n",
       "L 142.053882 37.894677 \n",
       "L 144.377268 49.863512 \n",
       "L 146.700655 64.008376 \n",
       "L 149.024042 79.634462 \n",
       "L 155.994201 128.520132 \n",
       "L 158.317588 143.534769 \n",
       "L 160.640974 157.212653 \n",
       "L 162.964361 169.328955 \n",
       "L 165.287747 179.781243 \n",
       "L 167.611134 188.572238 \n",
       "L 169.93452 195.787298 \n",
       "L 172.257907 201.569979 \n",
       "L 174.581293 206.098536 \n",
       "L 176.90468 209.565434 \n",
       "L 179.228066 212.161094 \n",
       "L 181.551453 214.062289 \n",
       "L 183.87484 215.424999 \n",
       "L 186.198226 216.381058 \n",
       "L 188.521613 217.037754 \n",
       "L 190.844999 217.479448 \n",
       "L 195.491772 217.95814 \n",
       "L 200.138545 218.150298 \n",
       "L 209.432091 218.245692 \n",
       "L 223.372411 218.256171 \n",
       "L 225.695797 20.583636 \n",
       "L 281.457074 20.583728 \n",
       "L 283.780461 218.256364 \n",
       "L 346.511897 218.256364 \n",
       "L 346.511897 218.256364 \n",
       "\" style=\"fill:none;stroke:#1f77b4;stroke-linecap:square;stroke-width:1.5;\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 26.930079 228.14 \n",
       "L 26.930079 10.7 \n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 361.730079 228.14 \n",
       "L 361.730079 10.7 \n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 26.930079 228.14 \n",
       "L 361.730079 228.14 \n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 26.930079 10.7 \n",
       "L 361.730079 10.7 \n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"pfeeef92832\">\n",
       "   <rect height=\"217.44\" width=\"334.8\" x=\"26.930079\" y=\"10.7\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "L = 1.0\n",
    "n = 128 # cells\n",
    "dx = L/n # n intervals\n",
    "x = np.linspace(-3*dx/2, L + 3*dx/2, n+4) # include ghost cells - we will include 2 ghost cells on each side for high order schemes\n",
    "\n",
    "# create arrays\n",
    "phi = np.zeros(n+4) # cell centered quantity\n",
    "f = np.zeros(n+4+1) # flux\n",
    "u = np.ones(n+4+1) # velocity field - assumed to live on faces same as flux\n",
    "\n",
    "x0 = 0.3\n",
    "# u0 = np.zeros(N + 2)\n",
    "# u0[1:-1] = np.sin(2*np.pi*x)\n",
    "# u0 = np.zeros(N)\n",
    "# phi0 = np.sin(np.pi*x)\n",
    "phi0 = gaussian(x,x0) + step(x,x0)\n",
    "# u0 = triangle(x,0.5,0.75,1)\n",
    "# u0[0:N//2] = 1.0\n",
    "plt.plot(x,phi0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "dt= 0.00390625\n",
      "dx= 0.0078125\n"
     ]
    }
   ],
   "source": [
    "cfl =0.5\n",
    "c = 1.0 # use a negative value for left traveling waves\n",
    "dt = cfl*dx/abs(c)\n",
    "print('dt=',dt)\n",
    "print('dx=',dx)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<!-- Created with matplotlib (https://matplotlib.org/) -->\n",
       "<svg height=\"209.311353pt\" version=\"1.1\" viewBox=\"0 0 351.935677 209.311353\" width=\"351.935677pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
       " <defs>\n",
       "  <style type=\"text/css\">\n",
       "*{stroke-linecap:butt;stroke-linejoin:round;}\n",
       "  </style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 209.311353 \n",
       "L 351.935677 209.311353 \n",
       "L 351.935677 0 \n",
       "L 0 0 \n",
       "z\n",
       "\" style=\"fill:none;\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 47.534499 173.4 \n",
       "L 338.370637 173.4 \n",
       "L 338.370637 10.7 \n",
       "L 47.534499 10.7 \n",
       "z\n",
       "\" style=\"fill:#ffffff;\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\">\n",
       "      <defs>\n",
       "       <path d=\"M 0 0 \n",
       "L 0 3.5 \n",
       "\" id=\"m79d55aacfd\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"47.534499\" xlink:href=\"#m79d55aacfd\" y=\"173.4\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_1\">\n",
       "      <!-- $0.0$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 42 31.84375 \n",
       "C 42 37.96875 41.90625 48.421875 37.703125 56.453125 \n",
       "C 34 63.484375 28.09375 66 22.90625 66 \n",
       "C 18.09375 66 12 63.78125 8.203125 56.5625 \n",
       "C 4.203125 49.015625 3.796875 39.671875 3.796875 31.84375 \n",
       "C 3.796875 26.109375 3.90625 17.375 7 9.734375 \n",
       "C 11.296875 -0.609375 19 -2 22.90625 -2 \n",
       "C 27.5 -2 34.5 -0.109375 38.59375 9.4375 \n",
       "C 41.59375 16.375 42 24.5 42 31.84375 \n",
       "z\n",
       "M 22.90625 -0.40625 \n",
       "C 16.5 -0.40625 12.703125 5.125 11.296875 12.75 \n",
       "C 10.203125 18.6875 10.203125 27.328125 10.203125 32.953125 \n",
       "C 10.203125 40.6875 10.203125 47.109375 11.5 53.234375 \n",
       "C 13.40625 61.78125 19 64.390625 22.90625 64.390625 \n",
       "C 27 64.390625 32.296875 61.671875 34.203125 53.4375 \n",
       "C 35.5 47.71875 35.59375 40.984375 35.59375 32.953125 \n",
       "C 35.59375 26.421875 35.59375 18.375 34.40625 12.453125 \n",
       "C 32.296875 1.5 26.40625 -0.40625 22.90625 -0.40625 \n",
       "z\n",
       "\" id=\"CMR17-48\"/>\n",
       "       <path d=\"M 18.40625 4.796875 \n",
       "C 18.40625 7.6875 16 9.6875 13.59375 9.6875 \n",
       "C 10.703125 9.6875 8.703125 7.296875 8.703125 4.890625 \n",
       "C 8.703125 2 11.09375 0 13.5 0 \n",
       "C 16.40625 0 18.40625 2.390625 18.40625 4.796875 \n",
       "z\n",
       "\" id=\"CMMI12-58\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(41.16946 187.318498)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_2\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"105.701727\" xlink:href=\"#m79d55aacfd\" y=\"173.4\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_2\">\n",
       "      <!-- $0.2$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 41.703125 15.46875 \n",
       "L 39.90625 15.46875 \n",
       "C 38.90625 8.390625 38.09375 7.1875 37.703125 6.59375 \n",
       "C 37.203125 5.796875 30 5.796875 28.59375 5.796875 \n",
       "L 9.40625 5.796875 \n",
       "C 13 9.6875 20 16.765625 28.5 24.9375 \n",
       "C 34.59375 30.71875 41.703125 37.5 41.703125 47.390625 \n",
       "C 41.703125 59.1875 32.296875 66 21.796875 66 \n",
       "C 10.796875 66 4.09375 56.296875 4.09375 47.296875 \n",
       "C 4.09375 43.390625 7 42.890625 8.203125 42.890625 \n",
       "C 9.203125 42.890625 12.203125 43.484375 12.203125 46.984375 \n",
       "C 12.203125 50.09375 9.59375 51 8.203125 51 \n",
       "C 7.59375 51 7 50.890625 6.59375 50.6875 \n",
       "C 8.5 59.1875 14.296875 63.390625 20.40625 63.390625 \n",
       "C 29.09375 63.390625 34.796875 56.5 34.796875 47.390625 \n",
       "C 34.796875 38.703125 29.703125 31.21875 24 24.734375 \n",
       "L 4.09375 2.296875 \n",
       "L 4.09375 0 \n",
       "L 39.296875 0 \n",
       "z\n",
       "\" id=\"CMR17-50\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(99.336687 187.318498)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-50\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"163.868955\" xlink:href=\"#m79d55aacfd\" y=\"173.4\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_3\">\n",
       "      <!-- $0.4$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 33.59375 64.796875 \n",
       "C 33.59375 66.890625 33.5 67 31.703125 67 \n",
       "L 2 19.59375 \n",
       "L 2 17 \n",
       "L 27.796875 17 \n",
       "L 27.796875 7.1875 \n",
       "C 27.796875 3.59375 27.59375 2.59375 20.59375 2.59375 \n",
       "L 18.703125 2.59375 \n",
       "L 18.703125 0 \n",
       "C 21.90625 0.1875 27.296875 0.1875 30.703125 0.1875 \n",
       "C 34.09375 0.1875 39.5 0.1875 42.703125 0 \n",
       "L 42.703125 2.59375 \n",
       "L 40.796875 2.59375 \n",
       "C 33.796875 2.59375 33.59375 3.59375 33.59375 7.1875 \n",
       "L 33.59375 17 \n",
       "L 43.796875 17 \n",
       "L 43.796875 19.59375 \n",
       "L 33.59375 19.59375 \n",
       "z\n",
       "M 28.09375 58.171875 \n",
       "L 28.09375 19.59375 \n",
       "L 4 19.59375 \n",
       "z\n",
       "\" id=\"CMR17-52\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(157.503915 187.318498)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-52\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_4\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"222.036182\" xlink:href=\"#m79d55aacfd\" y=\"173.4\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_4\">\n",
       "      <!-- $0.6$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 10.59375 34.34375 \n",
       "C 10.59375 58 21.796875 63.6875 28.296875 63.6875 \n",
       "C 30.40625 63.6875 35.5 63.265625 37.5 59.09375 \n",
       "C 35.90625 59.09375 32.90625 59.09375 32.90625 55.59375 \n",
       "C 32.90625 52.890625 35.09375 52 36.5 52 \n",
       "C 37.40625 52 40.09375 52.390625 40.09375 55.796875 \n",
       "C 40.09375 62.296875 35.09375 66 28.203125 66 \n",
       "C 16.296875 66 3.796875 53.296875 3.796875 31.421875 \n",
       "C 3.796875 4.015625 15.09375 -2 23.09375 -2 \n",
       "C 32.796875 -2 42 6.734375 42 20.234375 \n",
       "C 42 32.828125 33.90625 42 23.703125 42 \n",
       "C 17.59375 42 13.09375 37.96875 10.59375 30.921875 \n",
       "z\n",
       "M 23.09375 0.390625 \n",
       "C 10.796875 0.390625 10.796875 18.9375 10.796875 22.65625 \n",
       "C 10.796875 29.90625 14.203125 40.390625 23.5 40.390625 \n",
       "C 25.203125 40.390625 30.09375 40.390625 33.40625 33.4375 \n",
       "C 35.203125 29.515625 35.203125 25.375 35.203125 20.34375 \n",
       "C 35.203125 14.90625 35.203125 10.875 33.09375 6.84375 \n",
       "C 30.90625 2.703125 27.703125 0.390625 23.09375 0.390625 \n",
       "z\n",
       "\" id=\"CMR17-54\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(215.671143 187.318498)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-54\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"280.20341\" xlink:href=\"#m79d55aacfd\" y=\"173.4\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_5\">\n",
       "      <!-- $0.8$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 27.203125 35.765625 \n",
       "C 33.5 38.96875 39.90625 43.796875 39.90625 51.53125 \n",
       "C 39.90625 60.6875 31.09375 66 23 66 \n",
       "C 13.90625 66 5.90625 59.375 5.90625 50.234375 \n",
       "C 5.90625 47.71875 6.5 43.390625 10.40625 39.578125 \n",
       "C 11.40625 38.578125 15.59375 35.5625 18.296875 33.65625 \n",
       "C 13.796875 31.34375 3.296875 25.8125 3.296875 14.765625 \n",
       "C 3.296875 4.40625 13.09375 -2 22.796875 -2 \n",
       "C 33.5 -2 42.5 5.71875 42.5 15.96875 \n",
       "C 42.5 25.109375 36.40625 29.328125 32.40625 32.046875 \n",
       "z\n",
       "M 14.09375 44.609375 \n",
       "C 13.296875 45.109375 9.296875 48.21875 9.296875 52.9375 \n",
       "C 9.296875 59.078125 15.59375 63.6875 22.796875 63.6875 \n",
       "C 30.703125 63.6875 36.5 58.0625 36.5 51.53125 \n",
       "C 36.5 42.1875 26.09375 36.859375 25.59375 36.859375 \n",
       "C 25.5 36.859375 25.40625 36.859375 24.59375 37.46875 \n",
       "z\n",
       "M 32.5 24 \n",
       "C 34 22.90625 38.796875 19.578125 38.796875 13.453125 \n",
       "C 38.796875 6.015625 31.40625 0.390625 23 0.390625 \n",
       "C 13.90625 0.390625 7 6.921875 7 14.859375 \n",
       "C 7 22.796875 13.09375 29.4375 20 32.546875 \n",
       "z\n",
       "\" id=\"CMR17-56\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(273.83837 187.318498)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-56\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_6\">\n",
       "     <g id=\"line2d_6\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"338.370637\" xlink:href=\"#m79d55aacfd\" y=\"173.4\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_6\">\n",
       "      <!-- $1.0$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 26.59375 63.796875 \n",
       "C 26.59375 65.890625 26.5 66 25.09375 66 \n",
       "C 21.203125 61.359375 15.296875 59.890625 9.703125 59.6875 \n",
       "C 9.40625 59.6875 8.90625 59.6875 8.796875 59.5 \n",
       "C 8.703125 59.296875 8.703125 59.09375 8.703125 57 \n",
       "C 11.796875 57 17 57.59375 21 59.984375 \n",
       "L 21 7.296875 \n",
       "C 21 3.796875 20.796875 2.59375 12.203125 2.59375 \n",
       "L 9.203125 2.59375 \n",
       "L 9.203125 0 \n",
       "C 14 0.09375 19 0.1875 23.796875 0.1875 \n",
       "C 28.59375 0.1875 33.59375 0.09375 38.40625 0 \n",
       "L 38.40625 2.59375 \n",
       "L 35.40625 2.59375 \n",
       "C 26.796875 2.59375 26.59375 3.6875 26.59375 7.296875 \n",
       "z\n",
       "\" id=\"CMR17-49\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(332.005598 187.318498)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-49\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_7\">\n",
       "     <!-- $x$ -->\n",
       "     <defs>\n",
       "      <path d=\"M 47.40625 41 \n",
       "C 44.203125 40.390625 43 37.984375 43 36.09375 \n",
       "C 43 33.6875 44.90625 32.890625 46.296875 32.890625 \n",
       "C 49.296875 32.890625 51.40625 35.484375 51.40625 38.1875 \n",
       "C 51.40625 42.09375 46.59375 44 42.40625 44 \n",
       "C 36.296875 44 32.90625 38.296875 32 36.390625 \n",
       "C 29.703125 43.59375 23.5 44 21.703125 44 \n",
       "C 11.5 44 6.09375 31.140625 6.09375 28.890625 \n",
       "C 6.09375 28.484375 6.5 27.96875 7.203125 27.96875 \n",
       "C 8 27.96875 8.203125 28.578125 8.40625 28.984375 \n",
       "C 11.796875 40.1875 18.5 41.984375 21.40625 41.984375 \n",
       "C 25.90625 41.984375 26.796875 38.09375 26.796875 35.6875 \n",
       "C 26.796875 33.484375 26.203125 31.140625 25 26.21875 \n",
       "L 21.59375 12.15625 \n",
       "C 20.09375 6.09375 17.203125 1 11.90625 1 \n",
       "C 11.40625 1 8.90625 1 6.796875 1.96875 \n",
       "C 10.40625 2.59375 11.203125 5.59375 11.203125 6.796875 \n",
       "C 11.203125 8.796875 9.703125 10 7.796875 10 \n",
       "C 5.40625 10 2.796875 7.890625 2.796875 4.6875 \n",
       "C 2.796875 0.890625 7.5 -1 11.796875 -1 \n",
       "C 16.59375 -1 20 2.390625 22.09375 6.484375 \n",
       "C 23.703125 1 28.703125 -1 32.40625 -1 \n",
       "C 42.59375 -1 48 11.734375 48 14 \n",
       "C 48 14.515625 47.59375 14.921875 47 14.921875 \n",
       "C 46.09375 14.921875 46 14.40625 45.703125 13.59375 \n",
       "C 43 4.6875 37.203125 1 32.703125 1 \n",
       "C 29.203125 1 27.296875 3.1875 27.296875 7.296875 \n",
       "C 27.296875 9.484375 27.703125 11.125 29.296875 17.90625 \n",
       "L 32.796875 31.859375 \n",
       "C 34.296875 37.890625 37.703125 41.984375 42.296875 41.984375 \n",
       "C 42.5 41.984375 45.296875 41.984375 47.40625 41 \n",
       "z\n",
       "\" id=\"CMMI12-120\"/>\n",
       "     </defs>\n",
       "     <g transform=\"translate(190.105609 200.174175)scale(0.1 -0.1)\">\n",
       "      <use transform=\"scale(0.996264)\" xlink:href=\"#CMMI12-120\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <defs>\n",
       "       <path d=\"M 0 0 \n",
       "L -3.5 0 \n",
       "\" id=\"maee543df91\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"47.534499\" xlink:href=\"#maee543df91\" y=\"167.976667\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_8\">\n",
       "      <!-- $-0.2$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 65.90625 23 \n",
       "C 67.59375 23 69.40625 23 69.40625 25 \n",
       "C 69.40625 27 67.59375 27 65.90625 27 \n",
       "L 11.796875 27 \n",
       "C 10.09375 27 8.296875 27 8.296875 25 \n",
       "C 8.296875 23 10.09375 23 11.796875 23 \n",
       "z\n",
       "\" id=\"CMSY10-0\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(20.055677 171.435916)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMSY10-0\"/>\n",
       "       <use transform=\"translate(77.487468 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(123.177945 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(150.275122 0)scale(0.996264)\" xlink:href=\"#CMR17-50\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_8\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"47.534499\" xlink:href=\"#maee543df91\" y=\"146.283333\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_9\">\n",
       "      <!-- $0.0$ -->\n",
       "      <g transform=\"translate(27.80442 149.742583)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_9\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"47.534499\" xlink:href=\"#maee543df91\" y=\"124.59\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_10\">\n",
       "      <!-- $0.2$ -->\n",
       "      <g transform=\"translate(27.80442 128.049249)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-50\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_10\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"47.534499\" xlink:href=\"#maee543df91\" y=\"102.896667\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_11\">\n",
       "      <!-- $0.4$ -->\n",
       "      <g transform=\"translate(27.80442 106.355916)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-52\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_11\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"47.534499\" xlink:href=\"#maee543df91\" y=\"81.203333\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_12\">\n",
       "      <!-- $0.6$ -->\n",
       "      <g transform=\"translate(27.80442 84.662583)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-54\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_6\">\n",
       "     <g id=\"line2d_12\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"47.534499\" xlink:href=\"#maee543df91\" y=\"59.51\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_13\">\n",
       "      <!-- $0.8$ -->\n",
       "      <g transform=\"translate(27.80442 62.969249)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-56\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_7\">\n",
       "     <g id=\"line2d_13\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"47.534499\" xlink:href=\"#maee543df91\" y=\"37.816667\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_14\">\n",
       "      <!-- $1.0$ -->\n",
       "      <g transform=\"translate(27.80442 41.275916)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-49\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_8\">\n",
       "     <g id=\"line2d_14\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"47.534499\" xlink:href=\"#maee543df91\" y=\"16.123333\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_15\">\n",
       "      <!-- $1.2$ -->\n",
       "      <g transform=\"translate(27.80442 19.582583)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-49\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-50\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_16\">\n",
       "     <!-- $\\phi$ -->\n",
       "     <defs>\n",
       "      <path d=\"M 43 68.09375 \n",
       "C 43 69 42.296875 69 42 69 \n",
       "C 41.09375 69 41 68.796875 40.59375 67.09375 \n",
       "L 35.203125 45.6875 \n",
       "C 34.90625 44.390625 34.796875 44.296875 34.703125 44.1875 \n",
       "C 34.59375 44 33.90625 43.890625 33.703125 43.890625 \n",
       "C 17.296875 42.5 4.703125 29.109375 4.703125 16.734375 \n",
       "C 4.703125 6.046875 13 -0.5 23.40625 -1.109375 \n",
       "C 22.59375 -4.15625 21.90625 -7.296875 21.09375 -10.34375 \n",
       "C 19.703125 -15.546875 18.90625 -18.8125 18.90625 -19.203125 \n",
       "C 18.90625 -19.40625 18.90625 -20 19.90625 -20 \n",
       "C 20.203125 -20 20.59375 -20 20.796875 -19.609375 \n",
       "C 21 -19.40625 21.59375 -17.015625 22 -15.75 \n",
       "L 25.703125 -1.109375 \n",
       "C 42.796875 -0.203125 55.796875 13.671875 55.796875 26.140625 \n",
       "C 55.796875 36.140625 48.203125 43.296875 37.09375 44 \n",
       "z\n",
       "M 36.5 42 \n",
       "C 43.09375 41.59375 49.703125 37.9375 49.703125 28.21875 \n",
       "C 49.703125 17.03125 41.796875 2.1875 26.203125 1 \n",
       "z\n",
       "M 23.90625 0.890625 \n",
       "C 19 1.1875 10.796875 3.765625 10.796875 14.65625 \n",
       "C 10.796875 27.140625 19.90625 41 34.296875 41.890625 \n",
       "z\n",
       "\" id=\"CMMI12-30\"/>\n",
       "     </defs>\n",
       "     <g transform=\"translate(14.118498 95.018042)rotate(-90)scale(0.1 -0.1)\">\n",
       "      <use transform=\"scale(0.996264)\" xlink:href=\"#CMMI12-30\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 47.534499 173.4 \n",
       "L 47.534499 10.7 \n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 338.370637 173.4 \n",
       "L 338.370637 10.7 \n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 47.534499 173.4 \n",
       "L 338.370637 173.4 \n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 47.534499 10.7 \n",
       "L 338.370637 10.7 \n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 1000x600 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# the k scheme\n",
    "k = 0.5\n",
    "# finite volume implementation with arrays for fluxes\n",
    "t = 0\n",
    "tend= L/abs(c)\n",
    "\n",
    "sol = []\n",
    "sol.append(phi0)\n",
    "ims = []\n",
    "\n",
    "fig = plt.figure(figsize=[5,3],dpi=200)\n",
    "plt.rcParams[\"font.family\"] = \"serif\"\n",
    "plt.rcParams[\"font.size\"] = 10\n",
    "plt.rc('text', usetex=True)\n",
    "\n",
    "# plt.grid()\n",
    "plt.xlim([0.,L])\n",
    "plt.ylim([-0.25,1.25])\n",
    "plt.xlabel('$x$')\n",
    "plt.ylabel('$\\phi$')\n",
    "plt.tight_layout()\n",
    "# plot initial condition\n",
    "plt.plot(x,phi0,'darkred',animated=True)\n",
    "\n",
    "i = 0\n",
    "while t < tend:    \n",
    "    phin = sol[-1]\n",
    "\n",
    "#     if (i%16==0):\n",
    "#         shift = int(np.ceil(c*(t-dt)/dx))\n",
    "#         im = plt.plot(x[2:-2], np.roll(phin[2:-2], -shift) ,'k-o',markevery=2,markersize=3.5,markerfacecolor='deepskyblue',\n",
    "#              markeredgewidth=0.25, markeredgecolor='k',linewidth=0.45, animated=True)\n",
    "#         ims.append(im)\n",
    "    \n",
    "    # impose periodic conditions\n",
    "    phin[-2] = phin[2]\n",
    "    phin[-1] = phin[3]    \n",
    "    phin[0] = phin[-4]        \n",
    "    phin[1] = phin[-3]            \n",
    "    \n",
    "    phi = np.zeros_like(phi0)\n",
    "    \n",
    "    # predictor - take half a step and use upwind\n",
    "    # du/dt = -c*du/dx\n",
    "    if c >= 0:\n",
    "        ϕc = phin[1:-2] # phi upwind\n",
    "    else:\n",
    "        ϕc = phin[2:-1] # phi upwind\n",
    "    \n",
    "    f[2:-2] = c*ϕc\n",
    "    phi[2:-2] = phin[2:-2] - dt/2.0/dx*(f[3:-2] - f[2:-3])\n",
    "    phi[-2] = phi[2]\n",
    "    phi[-1] = phi[3]    \n",
    "    phi[0] = phi[-4]        \n",
    "    phi[1] = phi[-3]                \n",
    "    \n",
    "    # du/dt = -c*du/dx\n",
    "    if c >= 0:\n",
    "        ϕc = phi[1:-2] # phi upwind\n",
    "        ϕu = phi[:-3]  # phi far upwind\n",
    "        ϕd = phi[2:-1] # phi downwind\n",
    "    else:\n",
    "        ϕc = phi[2:-1] # phi upwind\n",
    "        ϕu = phi[3:]  # phi far upwind\n",
    "        ϕd = phi[1:-2] # phi downwind\n",
    "        \n",
    "    f[2:-2] = ϕc + (1-k)/4.0*(ϕc - ϕu) + (1+k)/4.0*(ϕd - ϕc)\n",
    "    f = c*f # multiply the flux by the velocity\n",
    "    # advect\n",
    "    phi[2:-2] = phin[2:-2] - c * dt/dx*(f[3:-2] - f[2:-3]) #+ dt/dx/dx*diffusion\n",
    "    t += dt    \n",
    "    i+=1\n",
    "    sol.append(phi)\n",
    "\n",
    "\n",
    "# plt.annotate('k = '+ str(k), xy=(0.5, 0.8), xytext=(0.015, 0.9),fontsize=8)\n",
    "# plt.legend(('exact','numerical'),loc='upper left',fontsize=7)\n",
    "# ani = animation.ArtistAnimation(fig, ims, interval=100, blit=True,\n",
    "#                                 repeat_delay=1000)\n",
    "\n",
    "# ani.save('k-scheme-'+str(k)+'.mp4',dpi=300,fps=24)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<!-- Created with matplotlib (https://matplotlib.org/) -->\n",
       "<svg height=\"251.195677pt\" version=\"1.1\" viewBox=\"0 0 380.178823 251.195677\" width=\"380.178823pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
       " <defs>\n",
       "  <style type=\"text/css\">\n",
       "*{stroke-linecap:butt;stroke-linejoin:round;}\n",
       "  </style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 251.195677 \n",
       "L 380.178823 251.195677 \n",
       "L 380.178823 0 \n",
       "L 0 0 \n",
       "z\n",
       "\" style=\"fill:none;\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 34.678823 228.14 \n",
       "L 369.478823 228.14 \n",
       "L 369.478823 10.7 \n",
       "L 34.678823 10.7 \n",
       "z\n",
       "\" style=\"fill:#ffffff;\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\">\n",
       "      <path clip-path=\"url(#p637cb68ffb)\" d=\"M 49.897005 228.14 \n",
       "L 49.897005 10.7 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_2\">\n",
       "      <defs>\n",
       "       <path d=\"M 0 0 \n",
       "L 0 3.5 \n",
       "\" id=\"md66edfb16e\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"49.897005\" xlink:href=\"#md66edfb16e\" y=\"228.14\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_1\">\n",
       "      <!-- $0$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 42 31.84375 \n",
       "C 42 37.96875 41.90625 48.421875 37.703125 56.453125 \n",
       "C 34 63.484375 28.09375 66 22.90625 66 \n",
       "C 18.09375 66 12 63.78125 8.203125 56.5625 \n",
       "C 4.203125 49.015625 3.796875 39.671875 3.796875 31.84375 \n",
       "C 3.796875 26.109375 3.90625 17.375 7 9.734375 \n",
       "C 11.296875 -0.609375 19 -2 22.90625 -2 \n",
       "C 27.5 -2 34.5 -0.109375 38.59375 9.4375 \n",
       "C 41.59375 16.375 42 24.5 42 31.84375 \n",
       "z\n",
       "M 22.90625 -0.40625 \n",
       "C 16.5 -0.40625 12.703125 5.125 11.296875 12.75 \n",
       "C 10.203125 18.6875 10.203125 27.328125 10.203125 32.953125 \n",
       "C 10.203125 40.6875 10.203125 47.109375 11.5 53.234375 \n",
       "C 13.40625 61.78125 19 64.390625 22.90625 64.390625 \n",
       "C 27 64.390625 32.296875 61.671875 34.203125 53.4375 \n",
       "C 35.5 47.71875 35.59375 40.984375 35.59375 32.953125 \n",
       "C 35.59375 26.421875 35.59375 18.375 34.40625 12.453125 \n",
       "C 32.296875 1.5 26.40625 -0.40625 22.90625 -0.40625 \n",
       "z\n",
       "\" id=\"CMR17-48\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(47.406337 242.058498)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <path clip-path=\"url(#p637cb68ffb)\" d=\"M 96.364735 228.14 \n",
       "L 96.364735 10.7 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_4\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"96.364735\" xlink:href=\"#md66edfb16e\" y=\"228.14\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_2\">\n",
       "      <!-- $20$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 41.703125 15.46875 \n",
       "L 39.90625 15.46875 \n",
       "C 38.90625 8.390625 38.09375 7.1875 37.703125 6.59375 \n",
       "C 37.203125 5.796875 30 5.796875 28.59375 5.796875 \n",
       "L 9.40625 5.796875 \n",
       "C 13 9.6875 20 16.765625 28.5 24.9375 \n",
       "C 34.59375 30.71875 41.703125 37.5 41.703125 47.390625 \n",
       "C 41.703125 59.1875 32.296875 66 21.796875 66 \n",
       "C 10.796875 66 4.09375 56.296875 4.09375 47.296875 \n",
       "C 4.09375 43.390625 7 42.890625 8.203125 42.890625 \n",
       "C 9.203125 42.890625 12.203125 43.484375 12.203125 46.984375 \n",
       "C 12.203125 50.09375 9.59375 51 8.203125 51 \n",
       "C 7.59375 51 7 50.890625 6.59375 50.6875 \n",
       "C 8.5 59.1875 14.296875 63.390625 20.40625 63.390625 \n",
       "C 29.09375 63.390625 34.796875 56.5 34.796875 47.390625 \n",
       "C 34.796875 38.703125 29.703125 31.21875 24 24.734375 \n",
       "L 4.09375 2.296875 \n",
       "L 4.09375 0 \n",
       "L 39.296875 0 \n",
       "z\n",
       "\" id=\"CMR17-50\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(91.3834 242.058498)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-50\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <path clip-path=\"url(#p637cb68ffb)\" d=\"M 142.832466 228.14 \n",
       "L 142.832466 10.7 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_6\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"142.832466\" xlink:href=\"#md66edfb16e\" y=\"228.14\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_3\">\n",
       "      <!-- $40$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 33.59375 64.796875 \n",
       "C 33.59375 66.890625 33.5 67 31.703125 67 \n",
       "L 2 19.59375 \n",
       "L 2 17 \n",
       "L 27.796875 17 \n",
       "L 27.796875 7.1875 \n",
       "C 27.796875 3.59375 27.59375 2.59375 20.59375 2.59375 \n",
       "L 18.703125 2.59375 \n",
       "L 18.703125 0 \n",
       "C 21.90625 0.1875 27.296875 0.1875 30.703125 0.1875 \n",
       "C 34.09375 0.1875 39.5 0.1875 42.703125 0 \n",
       "L 42.703125 2.59375 \n",
       "L 40.796875 2.59375 \n",
       "C 33.796875 2.59375 33.59375 3.59375 33.59375 7.1875 \n",
       "L 33.59375 17 \n",
       "L 43.796875 17 \n",
       "L 43.796875 19.59375 \n",
       "L 33.59375 19.59375 \n",
       "z\n",
       "M 28.09375 58.171875 \n",
       "L 28.09375 19.59375 \n",
       "L 4 19.59375 \n",
       "z\n",
       "\" id=\"CMR17-52\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(137.851131 242.058498)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-52\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <path clip-path=\"url(#p637cb68ffb)\" d=\"M 189.300197 228.14 \n",
       "L 189.300197 10.7 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_8\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"189.300197\" xlink:href=\"#md66edfb16e\" y=\"228.14\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_4\">\n",
       "      <!-- $60$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 10.59375 34.34375 \n",
       "C 10.59375 58 21.796875 63.6875 28.296875 63.6875 \n",
       "C 30.40625 63.6875 35.5 63.265625 37.5 59.09375 \n",
       "C 35.90625 59.09375 32.90625 59.09375 32.90625 55.59375 \n",
       "C 32.90625 52.890625 35.09375 52 36.5 52 \n",
       "C 37.40625 52 40.09375 52.390625 40.09375 55.796875 \n",
       "C 40.09375 62.296875 35.09375 66 28.203125 66 \n",
       "C 16.296875 66 3.796875 53.296875 3.796875 31.421875 \n",
       "C 3.796875 4.015625 15.09375 -2 23.09375 -2 \n",
       "C 32.796875 -2 42 6.734375 42 20.234375 \n",
       "C 42 32.828125 33.90625 42 23.703125 42 \n",
       "C 17.59375 42 13.09375 37.96875 10.59375 30.921875 \n",
       "z\n",
       "M 23.09375 0.390625 \n",
       "C 10.796875 0.390625 10.796875 18.9375 10.796875 22.65625 \n",
       "C 10.796875 29.90625 14.203125 40.390625 23.5 40.390625 \n",
       "C 25.203125 40.390625 30.09375 40.390625 33.40625 33.4375 \n",
       "C 35.203125 29.515625 35.203125 25.375 35.203125 20.34375 \n",
       "C 35.203125 14.90625 35.203125 10.875 33.09375 6.84375 \n",
       "C 30.90625 2.703125 27.703125 0.390625 23.09375 0.390625 \n",
       "z\n",
       "\" id=\"CMR17-54\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(184.318861 242.058498)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-54\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_9\">\n",
       "      <path clip-path=\"url(#p637cb68ffb)\" d=\"M 235.767927 228.14 \n",
       "L 235.767927 10.7 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_10\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"235.767927\" xlink:href=\"#md66edfb16e\" y=\"228.14\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_5\">\n",
       "      <!-- $80$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 27.203125 35.765625 \n",
       "C 33.5 38.96875 39.90625 43.796875 39.90625 51.53125 \n",
       "C 39.90625 60.6875 31.09375 66 23 66 \n",
       "C 13.90625 66 5.90625 59.375 5.90625 50.234375 \n",
       "C 5.90625 47.71875 6.5 43.390625 10.40625 39.578125 \n",
       "C 11.40625 38.578125 15.59375 35.5625 18.296875 33.65625 \n",
       "C 13.796875 31.34375 3.296875 25.8125 3.296875 14.765625 \n",
       "C 3.296875 4.40625 13.09375 -2 22.796875 -2 \n",
       "C 33.5 -2 42.5 5.71875 42.5 15.96875 \n",
       "C 42.5 25.109375 36.40625 29.328125 32.40625 32.046875 \n",
       "z\n",
       "M 14.09375 44.609375 \n",
       "C 13.296875 45.109375 9.296875 48.21875 9.296875 52.9375 \n",
       "C 9.296875 59.078125 15.59375 63.6875 22.796875 63.6875 \n",
       "C 30.703125 63.6875 36.5 58.0625 36.5 51.53125 \n",
       "C 36.5 42.1875 26.09375 36.859375 25.59375 36.859375 \n",
       "C 25.5 36.859375 25.40625 36.859375 24.59375 37.46875 \n",
       "z\n",
       "M 32.5 24 \n",
       "C 34 22.90625 38.796875 19.578125 38.796875 13.453125 \n",
       "C 38.796875 6.015625 31.40625 0.390625 23 0.390625 \n",
       "C 13.90625 0.390625 7 6.921875 7 14.859375 \n",
       "C 7 22.796875 13.09375 29.4375 20 32.546875 \n",
       "z\n",
       "\" id=\"CMR17-56\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(230.786592 242.058498)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-56\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_6\">\n",
       "     <g id=\"line2d_11\">\n",
       "      <path clip-path=\"url(#p637cb68ffb)\" d=\"M 282.235658 228.14 \n",
       "L 282.235658 10.7 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_12\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"282.235658\" xlink:href=\"#md66edfb16e\" y=\"228.14\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_6\">\n",
       "      <!-- $100$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 26.59375 63.796875 \n",
       "C 26.59375 65.890625 26.5 66 25.09375 66 \n",
       "C 21.203125 61.359375 15.296875 59.890625 9.703125 59.6875 \n",
       "C 9.40625 59.6875 8.90625 59.6875 8.796875 59.5 \n",
       "C 8.703125 59.296875 8.703125 59.09375 8.703125 57 \n",
       "C 11.796875 57 17 57.59375 21 59.984375 \n",
       "L 21 7.296875 \n",
       "C 21 3.796875 20.796875 2.59375 12.203125 2.59375 \n",
       "L 9.203125 2.59375 \n",
       "L 9.203125 0 \n",
       "C 14 0.09375 19 0.1875 23.796875 0.1875 \n",
       "C 28.59375 0.1875 33.59375 0.09375 38.40625 0 \n",
       "L 38.40625 2.59375 \n",
       "L 35.40625 2.59375 \n",
       "C 26.796875 2.59375 26.59375 3.6875 26.59375 7.296875 \n",
       "z\n",
       "\" id=\"CMR17-49\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(274.763655 242.058498)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-49\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(91.380954 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_7\">\n",
       "     <g id=\"line2d_13\">\n",
       "      <path clip-path=\"url(#p637cb68ffb)\" d=\"M 328.703389 228.14 \n",
       "L 328.703389 10.7 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_14\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"328.703389\" xlink:href=\"#md66edfb16e\" y=\"228.14\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_7\">\n",
       "      <!-- $120$ -->\n",
       "      <g transform=\"translate(321.231386 242.058498)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-49\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMR17-50\"/>\n",
       "       <use transform=\"translate(91.380954 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_15\">\n",
       "      <path clip-path=\"url(#p637cb68ffb)\" d=\"M 34.678823 217.992209 \n",
       "L 369.478823 217.992209 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_16\">\n",
       "      <defs>\n",
       "       <path d=\"M 0 0 \n",
       "L -3.5 0 \n",
       "\" id=\"m181bf7cb18\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.678823\" xlink:href=\"#m181bf7cb18\" y=\"217.992209\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_8\">\n",
       "      <!-- $-0.2$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 65.90625 23 \n",
       "C 67.59375 23 69.40625 23 69.40625 25 \n",
       "C 69.40625 27 67.59375 27 65.90625 27 \n",
       "L 11.796875 27 \n",
       "C 10.09375 27 8.296875 27 8.296875 25 \n",
       "C 8.296875 23 10.09375 23 11.796875 23 \n",
       "z\n",
       "\" id=\"CMSY10-0\"/>\n",
       "       <path d=\"M 18.40625 4.796875 \n",
       "C 18.40625 7.6875 16 9.6875 13.59375 9.6875 \n",
       "C 10.703125 9.6875 8.703125 7.296875 8.703125 4.890625 \n",
       "C 8.703125 2 11.09375 0 13.5 0 \n",
       "C 16.40625 0 18.40625 2.390625 18.40625 4.796875 \n",
       "z\n",
       "\" id=\"CMMI12-58\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(7.2 221.451458)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMSY10-0\"/>\n",
       "       <use transform=\"translate(77.487468 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(123.177945 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(150.275122 0)scale(0.996264)\" xlink:href=\"#CMR17-50\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_17\">\n",
       "      <path clip-path=\"url(#p637cb68ffb)\" d=\"M 34.678823 189.797914 \n",
       "L 369.478823 189.797914 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_18\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.678823\" xlink:href=\"#m181bf7cb18\" y=\"189.797914\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_9\">\n",
       "      <!-- $0.0$ -->\n",
       "      <g transform=\"translate(14.948744 193.257163)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_19\">\n",
       "      <path clip-path=\"url(#p637cb68ffb)\" d=\"M 34.678823 161.603618 \n",
       "L 369.478823 161.603618 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_20\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.678823\" xlink:href=\"#m181bf7cb18\" y=\"161.603618\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_10\">\n",
       "      <!-- $0.2$ -->\n",
       "      <g transform=\"translate(14.948744 165.062868)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-50\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_21\">\n",
       "      <path clip-path=\"url(#p637cb68ffb)\" d=\"M 34.678823 133.409323 \n",
       "L 369.478823 133.409323 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_22\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.678823\" xlink:href=\"#m181bf7cb18\" y=\"133.409323\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_11\">\n",
       "      <!-- $0.4$ -->\n",
       "      <g transform=\"translate(14.948744 136.868572)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-52\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_23\">\n",
       "      <path clip-path=\"url(#p637cb68ffb)\" d=\"M 34.678823 105.215028 \n",
       "L 369.478823 105.215028 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_24\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.678823\" xlink:href=\"#m181bf7cb18\" y=\"105.215028\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_12\">\n",
       "      <!-- $0.6$ -->\n",
       "      <g transform=\"translate(14.948744 108.674277)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-54\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_6\">\n",
       "     <g id=\"line2d_25\">\n",
       "      <path clip-path=\"url(#p637cb68ffb)\" d=\"M 34.678823 77.020733 \n",
       "L 369.478823 77.020733 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_26\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.678823\" xlink:href=\"#m181bf7cb18\" y=\"77.020733\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_13\">\n",
       "      <!-- $0.8$ -->\n",
       "      <g transform=\"translate(14.948744 80.479982)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-56\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_7\">\n",
       "     <g id=\"line2d_27\">\n",
       "      <path clip-path=\"url(#p637cb68ffb)\" d=\"M 34.678823 48.826437 \n",
       "L 369.478823 48.826437 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_28\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.678823\" xlink:href=\"#m181bf7cb18\" y=\"48.826437\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_14\">\n",
       "      <!-- $1.0$ -->\n",
       "      <g transform=\"translate(14.948744 52.285687)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-49\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_8\">\n",
       "     <g id=\"line2d_29\">\n",
       "      <path clip-path=\"url(#p637cb68ffb)\" d=\"M 34.678823 20.632142 \n",
       "L 369.478823 20.632142 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_30\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"34.678823\" xlink:href=\"#m181bf7cb18\" y=\"20.632142\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_15\">\n",
       "      <!-- $1.2$ -->\n",
       "      <g transform=\"translate(14.948744 24.091391)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-49\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-50\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_31\">\n",
       "    <path clip-path=\"url(#p637cb68ffb)\" d=\"M 49.897005 189.797914 \n",
       "L 77.777643 189.713745 \n",
       "L 82.424416 189.563058 \n",
       "L 87.071189 189.190731 \n",
       "L 89.394576 188.84916 \n",
       "L 91.717962 188.343446 \n",
       "L 94.041349 187.610297 \n",
       "L 96.364735 186.569755 \n",
       "L 98.688122 185.124277 \n",
       "L 101.011508 183.159389 \n",
       "L 103.334895 180.546574 \n",
       "L 105.658281 177.148972 \n",
       "L 107.981668 172.830321 \n",
       "L 110.305054 167.467191 \n",
       "L 112.628441 160.964118 \n",
       "L 114.951828 153.270634 \n",
       "L 117.275214 144.398594 \n",
       "L 119.598601 134.437689 \n",
       "L 121.921987 123.566681 \n",
       "L 131.215533 77.67672 \n",
       "L 133.53892 67.861012 \n",
       "L 135.862306 59.691385 \n",
       "L 138.185693 53.597159 \n",
       "L 140.509079 49.911213 \n",
       "L 142.832466 48.839881 \n",
       "L 145.155853 50.443822 \n",
       "L 147.479239 54.632335 \n",
       "L 149.802626 61.171849 \n",
       "L 152.126012 69.707498 \n",
       "L 154.449399 79.794997 \n",
       "L 156.772785 90.938838 \n",
       "L 163.742945 125.801959 \n",
       "L 166.066331 136.509741 \n",
       "L 168.389718 146.264209 \n",
       "L 170.713104 154.905026 \n",
       "L 173.036491 162.359141 \n",
       "L 175.359878 168.628494 \n",
       "L 177.683264 173.773959 \n",
       "L 180.006651 177.897914 \n",
       "L 182.330037 181.127483 \n",
       "L 184.653424 183.599923 \n",
       "L 186.97681 185.451034 \n",
       "L 189.300197 186.806883 \n",
       "L 191.623583 187.778708 \n",
       "L 193.94697 188.460528 \n",
       "L 196.270356 188.928854 \n",
       "L 200.917129 189.451349 \n",
       "L 205.563903 189.669862 \n",
       "L 214.857449 189.784008 \n",
       "L 231.121154 189.797776 \n",
       "L 233.444541 48.826372 \n",
       "L 289.205818 48.826437 \n",
       "L 291.529204 189.797914 \n",
       "L 354.260641 189.79759 \n",
       "L 354.260641 189.79759 \n",
       "\" style=\"fill:none;stroke:#1f77b4;stroke-linecap:square;stroke-width:1.5;\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_32\">\n",
       "    <path clip-path=\"url(#p637cb68ffb)\" d=\"M 49.897005 189.798273 \n",
       "L 80.10103 189.887755 \n",
       "L 89.394576 190.099982 \n",
       "L 91.717962 189.983633 \n",
       "L 94.041349 189.645557 \n",
       "L 96.364735 188.955957 \n",
       "L 98.688122 187.756242 \n",
       "L 101.011508 185.865338 \n",
       "L 103.334895 183.08962 \n",
       "L 105.658281 179.237211 \n",
       "L 107.981668 174.137757 \n",
       "L 110.305054 167.667403 \n",
       "L 112.628441 159.775531 \n",
       "L 114.951828 150.506751 \n",
       "L 117.275214 140.011417 \n",
       "L 119.598601 128.541868 \n",
       "L 128.892147 80.666439 \n",
       "L 131.215533 70.573473 \n",
       "L 133.53892 62.229805 \n",
       "L 135.862306 56.041342 \n",
       "L 138.185693 52.268757 \n",
       "L 140.509079 50.993734 \n",
       "L 142.832466 52.132253 \n",
       "L 145.155853 55.493295 \n",
       "L 147.479239 60.853553 \n",
       "L 149.802626 68.004178 \n",
       "L 152.126012 76.737821 \n",
       "L 154.449399 86.780704 \n",
       "L 161.419558 119.843871 \n",
       "L 163.742945 129.77983 \n",
       "L 166.066331 138.450358 \n",
       "L 168.389718 145.920919 \n",
       "L 173.036491 159.025857 \n",
       "L 180.006651 178.687525 \n",
       "L 182.330037 183.883645 \n",
       "L 184.653424 187.036115 \n",
       "L 186.97681 187.624012 \n",
       "L 189.300197 185.769125 \n",
       "L 193.94697 178.74233 \n",
       "L 196.270356 176.651864 \n",
       "L 198.593743 177.433605 \n",
       "L 200.917129 181.754321 \n",
       "L 203.240516 189.304979 \n",
       "L 207.887289 208.220784 \n",
       "L 210.210676 215.347346 \n",
       "L 212.534062 218.256364 \n",
       "L 214.857449 215.806189 \n",
       "L 217.180835 207.857195 \n",
       "L 219.504222 195.201675 \n",
       "L 221.827608 179.239403 \n",
       "L 231.121154 109.016881 \n",
       "L 233.444541 93.509332 \n",
       "L 235.767927 79.552997 \n",
       "L 238.091314 67.68917 \n",
       "L 240.414701 58.61682 \n",
       "L 242.738087 52.955019 \n",
       "L 245.061474 50.920648 \n",
       "L 247.38486 52.073178 \n",
       "L 249.708247 55.258248 \n",
       "L 252.031633 58.804461 \n",
       "L 254.35502 60.927764 \n",
       "L 256.678406 60.216785 \n",
       "L 259.001793 56.041519 \n",
       "L 261.325179 48.755382 \n",
       "L 265.971952 30.563954 \n",
       "L 268.295339 23.619246 \n",
       "L 270.618726 20.583636 \n",
       "L 272.942112 22.605144 \n",
       "L 275.265499 30.014712 \n",
       "L 277.588885 42.339964 \n",
       "L 279.912272 58.477967 \n",
       "L 284.559045 96.240856 \n",
       "L 286.882431 114.930551 \n",
       "L 289.205818 131.96459 \n",
       "L 291.529204 146.668494 \n",
       "L 293.852591 158.748215 \n",
       "L 296.175977 168.224134 \n",
       "L 298.499364 175.33771 \n",
       "L 300.822751 180.455311 \n",
       "L 303.146137 183.986131 \n",
       "L 305.469524 186.322659 \n",
       "L 307.79291 187.804978 \n",
       "L 310.116297 188.70547 \n",
       "L 312.439683 189.228237 \n",
       "L 314.76307 189.51734 \n",
       "L 319.409843 189.743652 \n",
       "L 328.703389 189.798621 \n",
       "L 354.260641 189.798207 \n",
       "L 354.260641 189.798207 \n",
       "\" style=\"fill:none;stroke:#ff7f0e;stroke-linecap:square;stroke-width:1.5;\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 34.678823 228.14 \n",
       "L 34.678823 10.7 \n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 369.478823 228.14 \n",
       "L 369.478823 10.7 \n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 34.678823 228.14 \n",
       "L 369.478823 228.14 \n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 34.678823 10.7 \n",
       "L 369.478823 10.7 \n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "   <g id=\"legend_1\">\n",
       "    <g id=\"patch_7\">\n",
       "     <path d=\"M 41.678823 46.574357 \n",
       "L 154.016549 46.574357 \n",
       "Q 156.016549 46.574357 156.016549 44.574357 \n",
       "L 156.016549 17.7 \n",
       "Q 156.016549 15.7 154.016549 15.7 \n",
       "L 41.678823 15.7 \n",
       "Q 39.678823 15.7 39.678823 17.7 \n",
       "L 39.678823 44.574357 \n",
       "Q 39.678823 46.574357 41.678823 46.574357 \n",
       "z\n",
       "\" style=\"fill:#ffffff;opacity:0.8;stroke:#cccccc;stroke-linejoin:miter;\"/>\n",
       "    </g>\n",
       "    <g id=\"line2d_33\">\n",
       "     <path d=\"M 43.678823 23.2 \n",
       "L 63.678823 23.2 \n",
       "\" style=\"fill:none;stroke:#1f77b4;stroke-linecap:square;stroke-width:1.5;\"/>\n",
       "    </g>\n",
       "    <g id=\"line2d_34\"/>\n",
       "    <g id=\"text_16\">\n",
       "     <!-- initial condition -->\n",
       "     <defs>\n",
       "      <path d=\"M 15.5 61.890625 \n",
       "C 15.5 64.09375 13.703125 66 11.40625 66 \n",
       "C 9.203125 66 7.296875 64.1875 7.296875 61.890625 \n",
       "C 7.296875 59.6875 9.09375 57.796875 11.40625 57.796875 \n",
       "C 13.59375 57.796875 15.5 59.59375 15.5 61.890625 \n",
       "z\n",
       "M 3.796875 42.890625 \n",
       "L 3.796875 40.296875 \n",
       "C 9.40625 40.296875 10.203125 39.6875 10.203125 34.859375 \n",
       "L 10.203125 6.921875 \n",
       "C 10.203125 3.09375 9.796875 2.59375 3.40625 2.59375 \n",
       "L 3.40625 0 \n",
       "C 5.796875 0.1875 10.09375 0.1875 12.59375 0.1875 \n",
       "C 15 0.1875 19.09375 0.1875 21.40625 0 \n",
       "L 21.40625 2.59375 \n",
       "C 15.5 2.59375 15.296875 3.203125 15.296875 6.8125 \n",
       "L 15.296875 44 \n",
       "z\n",
       "\" id=\"CMR17-105\"/>\n",
       "      <path d=\"M 41.5 30.53125 \n",
       "C 41.5 35.65625 40.5 44 28.703125 44 \n",
       "C 20.796875 44 16.703125 37.875 15.203125 33.84375 \n",
       "L 15.09375 33.84375 \n",
       "L 15.09375 44 \n",
       "L 3.296875 42.890625 \n",
       "L 3.296875 40.28125 \n",
       "C 9.203125 40.28125 10.09375 39.6875 10.09375 34.859375 \n",
       "L 10.09375 6.921875 \n",
       "C 10.09375 3.09375 9.703125 2.59375 3.296875 2.59375 \n",
       "L 3.296875 0 \n",
       "C 5.703125 0.1875 10.09375 0.1875 12.703125 0.1875 \n",
       "C 15.296875 0.1875 19.796875 0.1875 22.203125 0 \n",
       "L 22.203125 2.59375 \n",
       "C 15.796875 2.59375 15.40625 3 15.40625 6.921875 \n",
       "L 15.40625 26.21875 \n",
       "C 15.40625 35.453125 21 42.390625 28 42.390625 \n",
       "C 35.40625 42.390625 36.203125 35.765625 36.203125 30.9375 \n",
       "L 36.203125 6.921875 \n",
       "C 36.203125 3.09375 35.796875 2.59375 29.40625 2.59375 \n",
       "L 29.40625 0 \n",
       "C 31.796875 0.1875 36.203125 0.1875 38.796875 0.1875 \n",
       "C 41.40625 0.1875 45.90625 0.1875 48.296875 0 \n",
       "L 48.296875 2.59375 \n",
       "C 41.90625 2.59375 41.5 3 41.5 6.921875 \n",
       "z\n",
       "\" id=\"CMR17-110\"/>\n",
       "      <path d=\"M 15.09375 40.390625 \n",
       "L 29.09375 40.390625 \n",
       "L 29.09375 43 \n",
       "L 15.09375 43 \n",
       "L 15.09375 62 \n",
       "L 13.296875 62 \n",
       "C 13.09375 51.4375 9.59375 42.1875 1.09375 41.984375 \n",
       "L 1.09375 40.390625 \n",
       "L 9.796875 40.390625 \n",
       "L 9.796875 12.15625 \n",
       "C 9.796875 10.234375 9.796875 -1 21.40625 -1 \n",
       "C 27.296875 -1 30.703125 4.8125 30.703125 12.25 \n",
       "L 30.703125 17.984375 \n",
       "L 28.90625 17.984375 \n",
       "L 28.90625 12.34375 \n",
       "C 28.90625 5.421875 26.203125 0.796875 22 0.796875 \n",
       "C 19.09375 0.796875 15.09375 2.796875 15.09375 11.953125 \n",
       "z\n",
       "\" id=\"CMR17-116\"/>\n",
       "      <path d=\"M 36 25.875 \n",
       "C 36 32 36 35.546875 31.796875 39.59375 \n",
       "C 28.09375 42.984375 23.796875 44 20.40625 44 \n",
       "C 12.5 44 6.796875 37.625 6.796875 30.890625 \n",
       "C 6.796875 27.1875 9.796875 27 10.40625 27 \n",
       "C 11.703125 27 14 27.796875 14 30.59375 \n",
       "C 14 33.09375 12.09375 34.1875 10.40625 34.1875 \n",
       "C 10 34.1875 9.5 34.09375 9.203125 34 \n",
       "C 11.296875 40.53125 16.703125 42.390625 20.203125 42.390625 \n",
       "C 25.203125 42.390625 30.703125 37.828125 30.703125 29.296875 \n",
       "L 30.703125 25.5 \n",
       "C 24.796875 25.296875 17.703125 24.5 12.09375 21.453125 \n",
       "C 5.796875 17.921875 4 12.84375 4 9 \n",
       "C 4 1.203125 13 -1 18.296875 -1 \n",
       "C 23.796875 -1 28.90625 2.109375 31.09375 7.890625 \n",
       "C 31.296875 3.421875 34.09375 -0.609375 38.5 -0.609375 \n",
       "C 40.59375 -0.609375 45.90625 0.796875 45.90625 8.796875 \n",
       "L 45.90625 14.46875 \n",
       "L 44.09375 14.46875 \n",
       "L 44.09375 8.703125 \n",
       "C 44.09375 2.515625 41.40625 1.703125 40.09375 1.703125 \n",
       "C 36 1.703125 36 6.96875 36 11.4375 \n",
       "z\n",
       "M 30.703125 13.859375 \n",
       "C 30.703125 5.046875 24.5 0.59375 19 0.59375 \n",
       "C 14 0.59375 10.09375 4.34375 10.09375 9 \n",
       "C 10.09375 12.046875 11.40625 17.40625 17.203125 20.65625 \n",
       "C 22 23.390625 27.5 23.796875 30.703125 24 \n",
       "z\n",
       "\" id=\"CMR17-97\"/>\n",
       "      <path d=\"M 15.296875 69 \n",
       "L 3.40625 67.890625 \n",
       "L 3.40625 65.296875 \n",
       "C 9.296875 65.296875 10.203125 64.703125 10.203125 59.921875 \n",
       "L 10.203125 6.859375 \n",
       "C 10.203125 3.09375 9.796875 2.59375 3.40625 2.59375 \n",
       "L 3.40625 0 \n",
       "C 5.796875 0.1875 10.203125 0.1875 12.703125 0.1875 \n",
       "C 15.296875 0.1875 19.703125 0.1875 22.09375 0 \n",
       "L 22.09375 2.59375 \n",
       "C 15.703125 2.59375 15.296875 2.984375 15.296875 6.859375 \n",
       "z\n",
       "\" id=\"CMR17-108\"/>\n",
       "      <path d=\"M 34.90625 35 \n",
       "C 33 35 30.203125 35 30.203125 31.484375 \n",
       "C 30.203125 28.6875 32.5 27.890625 33.796875 27.890625 \n",
       "C 34.5 27.890625 37.40625 28.1875 37.40625 31.6875 \n",
       "C 37.40625 38.6875 30.59375 44 22.90625 44 \n",
       "C 12.296875 44 3.296875 34.390625 3.296875 21.546875 \n",
       "C 3.296875 8.140625 12.703125 -1 22.90625 -1 \n",
       "C 35.296875 -1 38.40625 10.5625 38.40625 11.671875 \n",
       "C 38.40625 12.078125 38.296875 12.375 37.59375 12.375 \n",
       "C 36.90625 12.375 36.796875 12.28125 36.40625 10.96875 \n",
       "C 33.796875 2.8125 28.09375 0.796875 23.796875 0.796875 \n",
       "C 17.40625 0.796875 9.703125 6.734375 9.703125 21.640625 \n",
       "C 9.703125 36.84375 17.09375 42.1875 23 42.1875 \n",
       "C 26.90625 42.1875 32.703125 40.34375 34.90625 35 \n",
       "z\n",
       "\" id=\"CMR17-99\"/>\n",
       "      <path d=\"M 43.09375 21.1875 \n",
       "C 43.09375 34 33.796875 44 22.90625 44 \n",
       "C 12 44 2.703125 34 2.703125 21.1875 \n",
       "C 2.703125 8.59375 12 -1 22.90625 -1 \n",
       "C 33.796875 -1 43.09375 8.59375 43.09375 21.1875 \n",
       "z\n",
       "M 22.90625 0.796875 \n",
       "C 18.203125 0.796875 14.203125 3.59375 11.90625 7.5 \n",
       "C 9.40625 12 9.09375 17.59375 9.09375 22 \n",
       "C 9.09375 26.1875 9.296875 31.390625 11.90625 35.890625 \n",
       "C 13.90625 39.1875 17.796875 42.390625 22.90625 42.390625 \n",
       "C 27.40625 42.390625 31.203125 39.890625 33.59375 36.390625 \n",
       "C 36.703125 31.6875 36.703125 25.09375 36.703125 22 \n",
       "C 36.703125 18.09375 36.5 12.09375 33.796875 7.296875 \n",
       "C 31 2.6875 26.703125 0.796875 22.90625 0.796875 \n",
       "z\n",
       "\" id=\"CMR17-111\"/>\n",
       "      <path d=\"M 29.203125 67.890625 \n",
       "L 29.203125 65.296875 \n",
       "C 35.09375 65.296875 36 64.703125 36 60.046875 \n",
       "L 36 37.046875 \n",
       "C 35.59375 37.546875 31.5 44 23.40625 44 \n",
       "C 13.203125 44 3.296875 34.8125 3.296875 21.5 \n",
       "C 3.296875 8.265625 12.59375 -1 22.40625 -1 \n",
       "C 30.90625 -1 35.296875 5.640625 35.796875 6.34375 \n",
       "L 35.796875 -1 \n",
       "L 47.90625 -0.203125 \n",
       "L 47.90625 2.40625 \n",
       "C 42 2.40625 41.09375 3.015625 41.09375 7.859375 \n",
       "L 41.09375 69 \n",
       "z\n",
       "M 35.796875 11.90625 \n",
       "C 35.796875 8.875 34 6.140625 31.703125 4.125 \n",
       "C 28.296875 1.09375 24.90625 0.59375 23 0.59375 \n",
       "C 20.09375 0.59375 9.703125 2.109375 9.703125 21.390625 \n",
       "C 9.703125 41.1875 21.296875 42.390625 23.90625 42.390625 \n",
       "C 28.5 42.390625 32.203125 39.765625 34.5 36.140625 \n",
       "C 35.796875 34.015625 35.796875 33.703125 35.796875 31.890625 \n",
       "z\n",
       "\" id=\"CMR17-100\"/>\n",
       "     </defs>\n",
       "     <g transform=\"translate(71.678823 26.7)scale(0.1 -0.1)\">\n",
       "      <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-105\"/>\n",
       "      <use transform=\"translate(24.871058 0)scale(0.996264)\" xlink:href=\"#CMR17-110\"/>\n",
       "      <use transform=\"translate(75.766428 0)scale(0.996264)\" xlink:href=\"#CMR17-105\"/>\n",
       "      <use transform=\"translate(100.637487 0)scale(0.996264)\" xlink:href=\"#CMR17-116\"/>\n",
       "      <use transform=\"translate(135.918255 0)scale(0.996264)\" xlink:href=\"#CMR17-105\"/>\n",
       "      <use transform=\"translate(160.789313 0)scale(0.996264)\" xlink:href=\"#CMR17-97\"/>\n",
       "      <use transform=\"translate(206.47979 0)scale(0.996264)\" xlink:href=\"#CMR17-108\"/>\n",
       "      <use transform=\"translate(261.426815 0)scale(0.996264)\" xlink:href=\"#CMR17-99\"/>\n",
       "      <use transform=\"translate(301.912475 0)scale(0.996264)\" xlink:href=\"#CMR17-111\"/>\n",
       "      <use transform=\"translate(347.602953 0)scale(0.996264)\" xlink:href=\"#CMR17-110\"/>\n",
       "      <use transform=\"translate(398.498322 0)scale(0.996264)\" xlink:href=\"#CMR17-100\"/>\n",
       "      <use transform=\"translate(449.393692 0)scale(0.996264)\" xlink:href=\"#CMR17-105\"/>\n",
       "      <use transform=\"translate(474.264751 0)scale(0.996264)\" xlink:href=\"#CMR17-116\"/>\n",
       "      <use transform=\"translate(509.545518 0)scale(0.996264)\" xlink:href=\"#CMR17-105\"/>\n",
       "      <use transform=\"translate(534.416577 0)scale(0.996264)\" xlink:href=\"#CMR17-111\"/>\n",
       "      <use transform=\"translate(580.107054 0)scale(0.996264)\" xlink:href=\"#CMR17-110\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"line2d_35\">\n",
       "     <path d=\"M 43.678823 37.137178 \n",
       "L 63.678823 37.137178 \n",
       "\" style=\"fill:none;stroke:#ff7f0e;stroke-linecap:square;stroke-width:1.5;\"/>\n",
       "    </g>\n",
       "    <g id=\"line2d_36\"/>\n",
       "    <g id=\"text_17\">\n",
       "     <!-- one residence time -->\n",
       "     <defs>\n",
       "      <path d=\"M 38.09375 23.484375 \n",
       "C 38.5 23.890625 38.5 24.09375 38.5 25.09375 \n",
       "C 38.5 35.171875 33.09375 44 21.703125 44 \n",
       "C 11.09375 44 2.703125 33.984375 2.703125 21.78125 \n",
       "C 2.703125 8.65625 12.203125 -1 22.796875 -1 \n",
       "C 34 -1 38.40625 9.671875 38.40625 11.796875 \n",
       "C 38.40625 12.5 37.796875 12.5 37.59375 12.5 \n",
       "C 36.90625 12.5 36.796875 12.296875 36.40625 11.078125 \n",
       "C 34.203125 4.21875 28.703125 0.796875 23.5 0.796875 \n",
       "C 19.203125 0.796875 14.90625 3.21875 12.203125 7.65625 \n",
       "C 9.09375 12.796875 9.09375 18.75 9.09375 23.484375 \n",
       "z\n",
       "M 9.203125 25 \n",
       "C 9.90625 39.234375 17.59375 42.390625 21.59375 42.390625 \n",
       "C 28.40625 42.390625 33 36.0625 33.09375 25 \n",
       "z\n",
       "\" id=\"CMR17-101\"/>\n",
       "      <path d=\"M 15 23.703125 \n",
       "C 15 33.34375 19.09375 42.390625 26.59375 42.390625 \n",
       "C 27.296875 42.390625 28 42.296875 28.703125 41.984375 \n",
       "C 28.703125 41.984375 26.5 41.28125 26.5 38.671875 \n",
       "C 26.5 36.265625 28.40625 35.265625 29.90625 35.265625 \n",
       "C 31.09375 35.265625 33.296875 35.96875 33.296875 38.78125 \n",
       "C 33.296875 41.984375 30.09375 44 26.703125 44 \n",
       "C 19.09375 44 15.796875 36.5625 14.796875 33.046875 \n",
       "L 14.703125 33.046875 \n",
       "L 14.703125 44 \n",
       "L 3.09375 42.890625 \n",
       "L 3.09375 40.28125 \n",
       "C 9 40.28125 9.90625 39.6875 9.90625 34.859375 \n",
       "L 9.90625 6.921875 \n",
       "C 9.90625 3.09375 9.5 2.59375 3.09375 2.59375 \n",
       "L 3.09375 0 \n",
       "C 5.5 0.1875 10.09375 0.1875 12.703125 0.1875 \n",
       "C 15.59375 0.1875 20.703125 0.1875 23.40625 0 \n",
       "L 23.40625 2.59375 \n",
       "C 16.203125 2.59375 15 2.59375 15 7.109375 \n",
       "z\n",
       "\" id=\"CMR17-114\"/>\n",
       "      <path d=\"M 30.90625 42 \n",
       "C 30.90625 43.796875 30.796875 43.890625 30.203125 43.890625 \n",
       "C 29.796875 43.890625 29.703125 43.796875 28.5 42.296875 \n",
       "C 28.203125 41.890625 27.296875 40.890625 27 40.5 \n",
       "C 23.796875 43.890625 19.296875 44 17.59375 44 \n",
       "C 6.5 44 2.5 38.1875 2.5 32.390625 \n",
       "C 2.5 23.390625 12.703125 21.296875 15.59375 20.6875 \n",
       "C 21.90625 19.390625 24.09375 19 26.203125 17.1875 \n",
       "C 27.5 16 29.703125 13.796875 29.703125 10.1875 \n",
       "C 29.703125 6 27.296875 0.59375 18.09375 0.59375 \n",
       "C 9.40625 0.59375 6.296875 7.1875 4.5 16 \n",
       "C 4.203125 17.390625 4.203125 17.5 3.40625 17.5 \n",
       "C 2.59375 17.5 2.5 17.390625 2.5 15.390625 \n",
       "L 2.5 1 \n",
       "C 2.5 -0.8125 2.59375 -0.90625 3.203125 -0.90625 \n",
       "C 3.703125 -0.90625 3.796875 -0.8125 4.296875 0 \n",
       "C 4.90625 0.890625 6.40625 3.296875 7 4.296875 \n",
       "C 9 1.59375 12.5 -1 18.09375 -1 \n",
       "C 28 -1 33.296875 4.390625 33.296875 12.1875 \n",
       "C 33.296875 17.296875 30.59375 20 29.296875 21.1875 \n",
       "C 26.296875 24.296875 22.796875 25 18.59375 25.796875 \n",
       "C 13.09375 27 6.09375 28.390625 6.09375 34.5 \n",
       "C 6.09375 37.09375 7.5 42.59375 17.59375 42.59375 \n",
       "C 28.296875 42.59375 28.90625 32.59375 29.09375 29.390625 \n",
       "C 29.203125 28.890625 29.703125 28.796875 30 28.796875 \n",
       "C 30.90625 28.796875 30.90625 29.09375 30.90625 30.796875 \n",
       "z\n",
       "\" id=\"CMR17-115\"/>\n",
       "      <path d=\"M 67.59375 30.53125 \n",
       "C 67.59375 35.5625 66.703125 44 54.796875 44 \n",
       "C 48 44 43.296875 39.375 41.5 33.953125 \n",
       "L 41.40625 33.953125 \n",
       "C 40.203125 42.1875 34.296875 44 28.703125 44 \n",
       "C 20.796875 44 16.703125 37.875 15.203125 33.84375 \n",
       "L 15.09375 33.84375 \n",
       "L 15.09375 44 \n",
       "L 3.296875 42.890625 \n",
       "L 3.296875 40.28125 \n",
       "C 9.203125 40.28125 10.09375 39.6875 10.09375 34.859375 \n",
       "L 10.09375 6.921875 \n",
       "C 10.09375 3.09375 9.703125 2.59375 3.296875 2.59375 \n",
       "L 3.296875 0 \n",
       "C 5.703125 0.1875 10.09375 0.1875 12.703125 0.1875 \n",
       "C 15.296875 0.1875 19.796875 0.1875 22.203125 0 \n",
       "L 22.203125 2.59375 \n",
       "C 15.796875 2.59375 15.40625 3 15.40625 6.921875 \n",
       "L 15.40625 26.21875 \n",
       "C 15.40625 35.453125 21 42.390625 28 42.390625 \n",
       "C 35.40625 42.390625 36.203125 35.765625 36.203125 30.9375 \n",
       "L 36.203125 6.921875 \n",
       "C 36.203125 3.09375 35.796875 2.59375 29.40625 2.59375 \n",
       "L 29.40625 0 \n",
       "C 31.796875 0.1875 36.203125 0.1875 38.796875 0.1875 \n",
       "C 41.40625 0.1875 45.90625 0.1875 48.296875 0 \n",
       "L 48.296875 2.59375 \n",
       "C 41.90625 2.59375 41.5 3 41.5 6.921875 \n",
       "L 41.5 26.21875 \n",
       "C 41.5 35.453125 47.09375 42.390625 54.09375 42.390625 \n",
       "C 61.5 42.390625 62.296875 35.765625 62.296875 30.9375 \n",
       "L 62.296875 6.921875 \n",
       "C 62.296875 3.09375 61.90625 2.59375 55.5 2.59375 \n",
       "L 55.5 0 \n",
       "C 57.90625 0.1875 62.296875 0.1875 64.90625 0.1875 \n",
       "C 67.5 0.1875 72 0.1875 74.40625 0 \n",
       "L 74.40625 2.59375 \n",
       "C 68 2.59375 67.59375 3 67.59375 6.921875 \n",
       "z\n",
       "\" id=\"CMR17-109\"/>\n",
       "     </defs>\n",
       "     <g transform=\"translate(71.678823 40.637178)scale(0.1 -0.1)\">\n",
       "      <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-111\"/>\n",
       "      <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMR17-110\"/>\n",
       "      <use transform=\"translate(96.585847 0)scale(0.996264)\" xlink:href=\"#CMR17-101\"/>\n",
       "      <use transform=\"translate(167.147474 0)scale(0.996264)\" xlink:href=\"#CMR17-114\"/>\n",
       "      <use transform=\"translate(202.428242 0)scale(0.996264)\" xlink:href=\"#CMR17-101\"/>\n",
       "      <use transform=\"translate(242.913902 0)scale(0.996264)\" xlink:href=\"#CMR17-115\"/>\n",
       "      <use transform=\"translate(278.71524 0)scale(0.996264)\" xlink:href=\"#CMR17-105\"/>\n",
       "      <use transform=\"translate(303.586298 0)scale(0.996264)\" xlink:href=\"#CMR17-100\"/>\n",
       "      <use transform=\"translate(354.481668 0)scale(0.996264)\" xlink:href=\"#CMR17-101\"/>\n",
       "      <use transform=\"translate(394.967328 0)scale(0.996264)\" xlink:href=\"#CMR17-110\"/>\n",
       "      <use transform=\"translate(445.862698 0)scale(0.996264)\" xlink:href=\"#CMR17-99\"/>\n",
       "      <use transform=\"translate(486.348359 0)scale(0.996264)\" xlink:href=\"#CMR17-101\"/>\n",
       "      <use transform=\"translate(556.909985 0)scale(0.996264)\" xlink:href=\"#CMR17-116\"/>\n",
       "      <use transform=\"translate(592.190753 0)scale(0.996264)\" xlink:href=\"#CMR17-105\"/>\n",
       "      <use transform=\"translate(617.061812 0)scale(0.996264)\" xlink:href=\"#CMR17-109\"/>\n",
       "      <use transform=\"translate(693.981402 0)scale(0.996264)\" xlink:href=\"#CMR17-101\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"p637cb68ffb\">\n",
       "   <rect height=\"217.44\" width=\"334.8\" x=\"34.678823\" y=\"10.7\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(sol[0], label='initial condition')\n",
    "plt.plot(sol[-1], label='one residence time')\n",
    "plt.legend()\n",
    "plt.grid()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Create Animation in Moving Reference Frame"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "done!\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<!-- Created with matplotlib (https://matplotlib.org/) -->\n",
       "<svg height=\"210.254175pt\" version=\"1.1\" viewBox=\"0 0 282.62 210.254175\" width=\"282.62pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
       " <defs>\n",
       "  <style type=\"text/css\">\n",
       "*{stroke-linecap:butt;stroke-linejoin:round;}\n",
       "  </style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 210.254175 \n",
       "L 282.62 210.254175 \n",
       "L 282.62 0 \n",
       "L 0 0 \n",
       "z\n",
       "\" style=\"fill:none;\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 26.930079 187.198498 \n",
       "L 271.92 187.198498 \n",
       "L 271.92 26.038498 \n",
       "L 26.930079 26.038498 \n",
       "z\n",
       "\" style=\"fill:#ffffff;\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\">\n",
       "      <path clip-path=\"url(#peffab07887)\" d=\"M 37.189142 187.198498 \n",
       "L 37.189142 26.038498 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_2\">\n",
       "      <defs>\n",
       "       <path d=\"M 0 0 \n",
       "L 0 3.5 \n",
       "\" id=\"m698cf3041e\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"37.189142\" xlink:href=\"#m698cf3041e\" y=\"187.198498\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_1\">\n",
       "      <!-- $0.0$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 42 31.84375 \n",
       "C 42 37.96875 41.90625 48.421875 37.703125 56.453125 \n",
       "C 34 63.484375 28.09375 66 22.90625 66 \n",
       "C 18.09375 66 12 63.78125 8.203125 56.5625 \n",
       "C 4.203125 49.015625 3.796875 39.671875 3.796875 31.84375 \n",
       "C 3.796875 26.109375 3.90625 17.375 7 9.734375 \n",
       "C 11.296875 -0.609375 19 -2 22.90625 -2 \n",
       "C 27.5 -2 34.5 -0.109375 38.59375 9.4375 \n",
       "C 41.59375 16.375 42 24.5 42 31.84375 \n",
       "z\n",
       "M 22.90625 -0.40625 \n",
       "C 16.5 -0.40625 12.703125 5.125 11.296875 12.75 \n",
       "C 10.203125 18.6875 10.203125 27.328125 10.203125 32.953125 \n",
       "C 10.203125 40.6875 10.203125 47.109375 11.5 53.234375 \n",
       "C 13.40625 61.78125 19 64.390625 22.90625 64.390625 \n",
       "C 27 64.390625 32.296875 61.671875 34.203125 53.4375 \n",
       "C 35.5 47.71875 35.59375 40.984375 35.59375 32.953125 \n",
       "C 35.59375 26.421875 35.59375 18.375 34.40625 12.453125 \n",
       "C 32.296875 1.5 26.40625 -0.40625 22.90625 -0.40625 \n",
       "z\n",
       "\" id=\"CMR17-48\"/>\n",
       "       <path d=\"M 18.40625 4.796875 \n",
       "C 18.40625 7.6875 16 9.6875 13.59375 9.6875 \n",
       "C 10.703125 9.6875 8.703125 7.296875 8.703125 4.890625 \n",
       "C 8.703125 2 11.09375 0 13.5 0 \n",
       "C 16.40625 0 18.40625 2.390625 18.40625 4.796875 \n",
       "z\n",
       "\" id=\"CMMI12-58\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(30.824102 201.116997)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <path clip-path=\"url(#peffab07887)\" d=\"M 82.083501 187.198498 \n",
       "L 82.083501 26.038498 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_4\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"82.083501\" xlink:href=\"#m698cf3041e\" y=\"187.198498\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_2\">\n",
       "      <!-- $0.2$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 41.703125 15.46875 \n",
       "L 39.90625 15.46875 \n",
       "C 38.90625 8.390625 38.09375 7.1875 37.703125 6.59375 \n",
       "C 37.203125 5.796875 30 5.796875 28.59375 5.796875 \n",
       "L 9.40625 5.796875 \n",
       "C 13 9.6875 20 16.765625 28.5 24.9375 \n",
       "C 34.59375 30.71875 41.703125 37.5 41.703125 47.390625 \n",
       "C 41.703125 59.1875 32.296875 66 21.796875 66 \n",
       "C 10.796875 66 4.09375 56.296875 4.09375 47.296875 \n",
       "C 4.09375 43.390625 7 42.890625 8.203125 42.890625 \n",
       "C 9.203125 42.890625 12.203125 43.484375 12.203125 46.984375 \n",
       "C 12.203125 50.09375 9.59375 51 8.203125 51 \n",
       "C 7.59375 51 7 50.890625 6.59375 50.6875 \n",
       "C 8.5 59.1875 14.296875 63.390625 20.40625 63.390625 \n",
       "C 29.09375 63.390625 34.796875 56.5 34.796875 47.390625 \n",
       "C 34.796875 38.703125 29.703125 31.21875 24 24.734375 \n",
       "L 4.09375 2.296875 \n",
       "L 4.09375 0 \n",
       "L 39.296875 0 \n",
       "z\n",
       "\" id=\"CMR17-50\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(75.718461 201.116997)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-50\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <path clip-path=\"url(#peffab07887)\" d=\"M 126.97786 187.198498 \n",
       "L 126.97786 26.038498 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_6\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"126.97786\" xlink:href=\"#m698cf3041e\" y=\"187.198498\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_3\">\n",
       "      <!-- $0.4$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 33.59375 64.796875 \n",
       "C 33.59375 66.890625 33.5 67 31.703125 67 \n",
       "L 2 19.59375 \n",
       "L 2 17 \n",
       "L 27.796875 17 \n",
       "L 27.796875 7.1875 \n",
       "C 27.796875 3.59375 27.59375 2.59375 20.59375 2.59375 \n",
       "L 18.703125 2.59375 \n",
       "L 18.703125 0 \n",
       "C 21.90625 0.1875 27.296875 0.1875 30.703125 0.1875 \n",
       "C 34.09375 0.1875 39.5 0.1875 42.703125 0 \n",
       "L 42.703125 2.59375 \n",
       "L 40.796875 2.59375 \n",
       "C 33.796875 2.59375 33.59375 3.59375 33.59375 7.1875 \n",
       "L 33.59375 17 \n",
       "L 43.796875 17 \n",
       "L 43.796875 19.59375 \n",
       "L 33.59375 19.59375 \n",
       "z\n",
       "M 28.09375 58.171875 \n",
       "L 28.09375 19.59375 \n",
       "L 4 19.59375 \n",
       "z\n",
       "\" id=\"CMR17-52\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(120.61282 201.116997)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-52\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <path clip-path=\"url(#peffab07887)\" d=\"M 171.872219 187.198498 \n",
       "L 171.872219 26.038498 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_8\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"171.872219\" xlink:href=\"#m698cf3041e\" y=\"187.198498\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_4\">\n",
       "      <!-- $0.6$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 10.59375 34.34375 \n",
       "C 10.59375 58 21.796875 63.6875 28.296875 63.6875 \n",
       "C 30.40625 63.6875 35.5 63.265625 37.5 59.09375 \n",
       "C 35.90625 59.09375 32.90625 59.09375 32.90625 55.59375 \n",
       "C 32.90625 52.890625 35.09375 52 36.5 52 \n",
       "C 37.40625 52 40.09375 52.390625 40.09375 55.796875 \n",
       "C 40.09375 62.296875 35.09375 66 28.203125 66 \n",
       "C 16.296875 66 3.796875 53.296875 3.796875 31.421875 \n",
       "C 3.796875 4.015625 15.09375 -2 23.09375 -2 \n",
       "C 32.796875 -2 42 6.734375 42 20.234375 \n",
       "C 42 32.828125 33.90625 42 23.703125 42 \n",
       "C 17.59375 42 13.09375 37.96875 10.59375 30.921875 \n",
       "z\n",
       "M 23.09375 0.390625 \n",
       "C 10.796875 0.390625 10.796875 18.9375 10.796875 22.65625 \n",
       "C 10.796875 29.90625 14.203125 40.390625 23.5 40.390625 \n",
       "C 25.203125 40.390625 30.09375 40.390625 33.40625 33.4375 \n",
       "C 35.203125 29.515625 35.203125 25.375 35.203125 20.34375 \n",
       "C 35.203125 14.90625 35.203125 10.875 33.09375 6.84375 \n",
       "C 30.90625 2.703125 27.703125 0.390625 23.09375 0.390625 \n",
       "z\n",
       "\" id=\"CMR17-54\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(165.50718 201.116997)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-54\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_9\">\n",
       "      <path clip-path=\"url(#peffab07887)\" d=\"M 216.766578 187.198498 \n",
       "L 216.766578 26.038498 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_10\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"216.766578\" xlink:href=\"#m698cf3041e\" y=\"187.198498\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_5\">\n",
       "      <!-- $0.8$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 27.203125 35.765625 \n",
       "C 33.5 38.96875 39.90625 43.796875 39.90625 51.53125 \n",
       "C 39.90625 60.6875 31.09375 66 23 66 \n",
       "C 13.90625 66 5.90625 59.375 5.90625 50.234375 \n",
       "C 5.90625 47.71875 6.5 43.390625 10.40625 39.578125 \n",
       "C 11.40625 38.578125 15.59375 35.5625 18.296875 33.65625 \n",
       "C 13.796875 31.34375 3.296875 25.8125 3.296875 14.765625 \n",
       "C 3.296875 4.40625 13.09375 -2 22.796875 -2 \n",
       "C 33.5 -2 42.5 5.71875 42.5 15.96875 \n",
       "C 42.5 25.109375 36.40625 29.328125 32.40625 32.046875 \n",
       "z\n",
       "M 14.09375 44.609375 \n",
       "C 13.296875 45.109375 9.296875 48.21875 9.296875 52.9375 \n",
       "C 9.296875 59.078125 15.59375 63.6875 22.796875 63.6875 \n",
       "C 30.703125 63.6875 36.5 58.0625 36.5 51.53125 \n",
       "C 36.5 42.1875 26.09375 36.859375 25.59375 36.859375 \n",
       "C 25.5 36.859375 25.40625 36.859375 24.59375 37.46875 \n",
       "z\n",
       "M 32.5 24 \n",
       "C 34 22.90625 38.796875 19.578125 38.796875 13.453125 \n",
       "C 38.796875 6.015625 31.40625 0.390625 23 0.390625 \n",
       "C 13.90625 0.390625 7 6.921875 7 14.859375 \n",
       "C 7 22.796875 13.09375 29.4375 20 32.546875 \n",
       "z\n",
       "\" id=\"CMR17-56\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(210.401539 201.116997)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-56\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_6\">\n",
       "     <g id=\"line2d_11\">\n",
       "      <path clip-path=\"url(#peffab07887)\" d=\"M 261.660937 187.198498 \n",
       "L 261.660937 26.038498 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_12\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"261.660937\" xlink:href=\"#m698cf3041e\" y=\"187.198498\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_6\">\n",
       "      <!-- $1.0$ -->\n",
       "      <defs>\n",
       "       <path d=\"M 26.59375 63.796875 \n",
       "C 26.59375 65.890625 26.5 66 25.09375 66 \n",
       "C 21.203125 61.359375 15.296875 59.890625 9.703125 59.6875 \n",
       "C 9.40625 59.6875 8.90625 59.6875 8.796875 59.5 \n",
       "C 8.703125 59.296875 8.703125 59.09375 8.703125 57 \n",
       "C 11.796875 57 17 57.59375 21 59.984375 \n",
       "L 21 7.296875 \n",
       "C 21 3.796875 20.796875 2.59375 12.203125 2.59375 \n",
       "L 9.203125 2.59375 \n",
       "L 9.203125 0 \n",
       "C 14 0.09375 19 0.1875 23.796875 0.1875 \n",
       "C 28.59375 0.1875 33.59375 0.09375 38.40625 0 \n",
       "L 38.40625 2.59375 \n",
       "L 35.40625 2.59375 \n",
       "C 26.796875 2.59375 26.59375 3.6875 26.59375 7.296875 \n",
       "z\n",
       "\" id=\"CMR17-49\"/>\n",
       "      </defs>\n",
       "      <g transform=\"translate(255.295898 201.116997)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-49\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_13\">\n",
       "      <path clip-path=\"url(#peffab07887)\" d=\"M 26.930079 179.873044 \n",
       "L 271.92 179.873044 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_14\">\n",
       "      <defs>\n",
       "       <path d=\"M 0 0 \n",
       "L -3.5 0 \n",
       "\" id=\"m89b3c9e072\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"26.930079\" xlink:href=\"#m89b3c9e072\" y=\"179.873044\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_7\">\n",
       "      <!-- $0.0$ -->\n",
       "      <g transform=\"translate(7.2 183.332293)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_15\">\n",
       "      <path clip-path=\"url(#peffab07887)\" d=\"M 26.930079 150.571239 \n",
       "L 271.92 150.571239 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_16\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"26.930079\" xlink:href=\"#m89b3c9e072\" y=\"150.571239\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_8\">\n",
       "      <!-- $0.2$ -->\n",
       "      <g transform=\"translate(7.2 154.030488)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-50\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_17\">\n",
       "      <path clip-path=\"url(#peffab07887)\" d=\"M 26.930079 121.269435 \n",
       "L 271.92 121.269435 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_18\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"26.930079\" xlink:href=\"#m89b3c9e072\" y=\"121.269435\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_9\">\n",
       "      <!-- $0.4$ -->\n",
       "      <g transform=\"translate(7.2 124.728684)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-52\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_19\">\n",
       "      <path clip-path=\"url(#peffab07887)\" d=\"M 26.930079 91.96763 \n",
       "L 271.92 91.96763 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_20\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"26.930079\" xlink:href=\"#m89b3c9e072\" y=\"91.96763\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_10\">\n",
       "      <!-- $0.6$ -->\n",
       "      <g transform=\"translate(7.2 95.426879)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-54\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_21\">\n",
       "      <path clip-path=\"url(#peffab07887)\" d=\"M 26.930079 62.665826 \n",
       "L 271.92 62.665826 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_22\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"26.930079\" xlink:href=\"#m89b3c9e072\" y=\"62.665826\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_11\">\n",
       "      <!-- $0.8$ -->\n",
       "      <g transform=\"translate(7.2 66.125075)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-56\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_6\">\n",
       "     <g id=\"line2d_23\">\n",
       "      <path clip-path=\"url(#peffab07887)\" d=\"M 26.930079 33.364021 \n",
       "L 271.92 33.364021 \n",
       "\" style=\"fill:none;stroke:#b0b0b0;stroke-linecap:square;stroke-width:0.8;\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_24\">\n",
       "      <g>\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"26.930079\" xlink:href=\"#m89b3c9e072\" y=\"33.364021\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_12\">\n",
       "      <!-- $1.0$ -->\n",
       "      <g transform=\"translate(7.2 36.82327)scale(0.1 -0.1)\">\n",
       "       <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-49\"/>\n",
       "       <use transform=\"translate(45.690477 0)scale(0.996264)\" xlink:href=\"#CMMI12-58\"/>\n",
       "       <use transform=\"translate(72.787654 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 26.930079 187.198498 \n",
       "L 26.930079 26.038498 \n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 271.92 187.198498 \n",
       "L 271.92 26.038498 \n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 26.930079 187.198498 \n",
       "L 271.92 187.198498 \n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 26.930079 26.038498 \n",
       "L 271.92 26.038498 \n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
       "   </g>\n",
       "   <g id=\"text_13\">\n",
       "    <!-- time =1.0 s -->\n",
       "    <defs>\n",
       "     <path d=\"M 15.09375 40.390625 \n",
       "L 29.09375 40.390625 \n",
       "L 29.09375 43 \n",
       "L 15.09375 43 \n",
       "L 15.09375 62 \n",
       "L 13.296875 62 \n",
       "C 13.09375 51.4375 9.59375 42.1875 1.09375 41.984375 \n",
       "L 1.09375 40.390625 \n",
       "L 9.796875 40.390625 \n",
       "L 9.796875 12.15625 \n",
       "C 9.796875 10.234375 9.796875 -1 21.40625 -1 \n",
       "C 27.296875 -1 30.703125 4.8125 30.703125 12.25 \n",
       "L 30.703125 17.984375 \n",
       "L 28.90625 17.984375 \n",
       "L 28.90625 12.34375 \n",
       "C 28.90625 5.421875 26.203125 0.796875 22 0.796875 \n",
       "C 19.09375 0.796875 15.09375 2.796875 15.09375 11.953125 \n",
       "z\n",
       "\" id=\"CMR17-116\"/>\n",
       "     <path d=\"M 15.5 61.890625 \n",
       "C 15.5 64.09375 13.703125 66 11.40625 66 \n",
       "C 9.203125 66 7.296875 64.1875 7.296875 61.890625 \n",
       "C 7.296875 59.6875 9.09375 57.796875 11.40625 57.796875 \n",
       "C 13.59375 57.796875 15.5 59.59375 15.5 61.890625 \n",
       "z\n",
       "M 3.796875 42.890625 \n",
       "L 3.796875 40.296875 \n",
       "C 9.40625 40.296875 10.203125 39.6875 10.203125 34.859375 \n",
       "L 10.203125 6.921875 \n",
       "C 10.203125 3.09375 9.796875 2.59375 3.40625 2.59375 \n",
       "L 3.40625 0 \n",
       "C 5.796875 0.1875 10.09375 0.1875 12.59375 0.1875 \n",
       "C 15 0.1875 19.09375 0.1875 21.40625 0 \n",
       "L 21.40625 2.59375 \n",
       "C 15.5 2.59375 15.296875 3.203125 15.296875 6.8125 \n",
       "L 15.296875 44 \n",
       "z\n",
       "\" id=\"CMR17-105\"/>\n",
       "     <path d=\"M 67.59375 30.53125 \n",
       "C 67.59375 35.5625 66.703125 44 54.796875 44 \n",
       "C 48 44 43.296875 39.375 41.5 33.953125 \n",
       "L 41.40625 33.953125 \n",
       "C 40.203125 42.1875 34.296875 44 28.703125 44 \n",
       "C 20.796875 44 16.703125 37.875 15.203125 33.84375 \n",
       "L 15.09375 33.84375 \n",
       "L 15.09375 44 \n",
       "L 3.296875 42.890625 \n",
       "L 3.296875 40.28125 \n",
       "C 9.203125 40.28125 10.09375 39.6875 10.09375 34.859375 \n",
       "L 10.09375 6.921875 \n",
       "C 10.09375 3.09375 9.703125 2.59375 3.296875 2.59375 \n",
       "L 3.296875 0 \n",
       "C 5.703125 0.1875 10.09375 0.1875 12.703125 0.1875 \n",
       "C 15.296875 0.1875 19.796875 0.1875 22.203125 0 \n",
       "L 22.203125 2.59375 \n",
       "C 15.796875 2.59375 15.40625 3 15.40625 6.921875 \n",
       "L 15.40625 26.21875 \n",
       "C 15.40625 35.453125 21 42.390625 28 42.390625 \n",
       "C 35.40625 42.390625 36.203125 35.765625 36.203125 30.9375 \n",
       "L 36.203125 6.921875 \n",
       "C 36.203125 3.09375 35.796875 2.59375 29.40625 2.59375 \n",
       "L 29.40625 0 \n",
       "C 31.796875 0.1875 36.203125 0.1875 38.796875 0.1875 \n",
       "C 41.40625 0.1875 45.90625 0.1875 48.296875 0 \n",
       "L 48.296875 2.59375 \n",
       "C 41.90625 2.59375 41.5 3 41.5 6.921875 \n",
       "L 41.5 26.21875 \n",
       "C 41.5 35.453125 47.09375 42.390625 54.09375 42.390625 \n",
       "C 61.5 42.390625 62.296875 35.765625 62.296875 30.9375 \n",
       "L 62.296875 6.921875 \n",
       "C 62.296875 3.09375 61.90625 2.59375 55.5 2.59375 \n",
       "L 55.5 0 \n",
       "C 57.90625 0.1875 62.296875 0.1875 64.90625 0.1875 \n",
       "C 67.5 0.1875 72 0.1875 74.40625 0 \n",
       "L 74.40625 2.59375 \n",
       "C 68 2.59375 67.59375 3 67.59375 6.921875 \n",
       "z\n",
       "\" id=\"CMR17-109\"/>\n",
       "     <path d=\"M 38.09375 23.484375 \n",
       "C 38.5 23.890625 38.5 24.09375 38.5 25.09375 \n",
       "C 38.5 35.171875 33.09375 44 21.703125 44 \n",
       "C 11.09375 44 2.703125 33.984375 2.703125 21.78125 \n",
       "C 2.703125 8.65625 12.203125 -1 22.796875 -1 \n",
       "C 34 -1 38.40625 9.671875 38.40625 11.796875 \n",
       "C 38.40625 12.5 37.796875 12.5 37.59375 12.5 \n",
       "C 36.90625 12.5 36.796875 12.296875 36.40625 11.078125 \n",
       "C 34.203125 4.21875 28.703125 0.796875 23.5 0.796875 \n",
       "C 19.203125 0.796875 14.90625 3.21875 12.203125 7.65625 \n",
       "C 9.09375 12.796875 9.09375 18.75 9.09375 23.484375 \n",
       "z\n",
       "M 9.203125 25 \n",
       "C 9.90625 39.234375 17.59375 42.390625 21.59375 42.390625 \n",
       "C 28.40625 42.390625 33 36.0625 33.09375 25 \n",
       "z\n",
       "\" id=\"CMR17-101\"/>\n",
       "     <path d=\"M 64.296875 32 \n",
       "C 65.796875 32 67.296875 32 67.296875 33.6875 \n",
       "C 67.296875 35.5 65.59375 35.5 63.90625 35.5 \n",
       "L 8 35.5 \n",
       "C 6.296875 35.5 4.59375 35.5 4.59375 33.6875 \n",
       "C 4.59375 32 6.09375 32 7.59375 32 \n",
       "z\n",
       "M 63.90625 14.484375 \n",
       "C 65.59375 14.484375 67.296875 14.484375 67.296875 16.296875 \n",
       "C 67.296875 18 65.796875 18 64.296875 18 \n",
       "L 7.59375 18 \n",
       "C 6.09375 18 4.59375 18 4.59375 16.296875 \n",
       "C 4.59375 14.484375 6.296875 14.484375 8 14.484375 \n",
       "z\n",
       "\" id=\"CMR17-61\"/>\n",
       "     <path d=\"M 16.59375 4.09375 \n",
       "C 16.59375 6.59375 14.59375 8.1875 12.5 8.1875 \n",
       "C 10.5 8.1875 8.40625 6.59375 8.40625 4.09375 \n",
       "C 8.40625 1.59375 10.40625 0 12.5 0 \n",
       "C 14.5 0 16.59375 1.59375 16.59375 4.09375 \n",
       "z\n",
       "\" id=\"CMR17-46\"/>\n",
       "     <path d=\"M 30.90625 42 \n",
       "C 30.90625 43.796875 30.796875 43.890625 30.203125 43.890625 \n",
       "C 29.796875 43.890625 29.703125 43.796875 28.5 42.296875 \n",
       "C 28.203125 41.890625 27.296875 40.890625 27 40.5 \n",
       "C 23.796875 43.890625 19.296875 44 17.59375 44 \n",
       "C 6.5 44 2.5 38.1875 2.5 32.390625 \n",
       "C 2.5 23.390625 12.703125 21.296875 15.59375 20.6875 \n",
       "C 21.90625 19.390625 24.09375 19 26.203125 17.1875 \n",
       "C 27.5 16 29.703125 13.796875 29.703125 10.1875 \n",
       "C 29.703125 6 27.296875 0.59375 18.09375 0.59375 \n",
       "C 9.40625 0.59375 6.296875 7.1875 4.5 16 \n",
       "C 4.203125 17.390625 4.203125 17.5 3.40625 17.5 \n",
       "C 2.59375 17.5 2.5 17.390625 2.5 15.390625 \n",
       "L 2.5 1 \n",
       "C 2.5 -0.8125 2.59375 -0.90625 3.203125 -0.90625 \n",
       "C 3.703125 -0.90625 3.796875 -0.8125 4.296875 0 \n",
       "C 4.90625 0.890625 6.40625 3.296875 7 4.296875 \n",
       "C 9 1.59375 12.5 -1 18.09375 -1 \n",
       "C 28 -1 33.296875 4.390625 33.296875 12.1875 \n",
       "C 33.296875 17.296875 30.59375 20 29.296875 21.1875 \n",
       "C 26.296875 24.296875 22.796875 25 18.59375 25.796875 \n",
       "C 13.09375 27 6.09375 28.390625 6.09375 34.5 \n",
       "C 6.09375 37.09375 7.5 42.59375 17.59375 42.59375 \n",
       "C 28.296875 42.59375 28.90625 32.59375 29.09375 29.390625 \n",
       "C 29.203125 28.890625 29.703125 28.796875 30 28.796875 \n",
       "C 30.90625 28.796875 30.90625 29.09375 30.90625 30.796875 \n",
       "z\n",
       "\" id=\"CMR17-115\"/>\n",
       "    </defs>\n",
       "    <g transform=\"translate(40 10.254175)scale(0.1 -0.1)\">\n",
       "     <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-116\"/>\n",
       "     <use transform=\"translate(35.280768 0)scale(0.996264)\" xlink:href=\"#CMR17-105\"/>\n",
       "     <use transform=\"translate(60.151826 0)scale(0.996264)\" xlink:href=\"#CMR17-109\"/>\n",
       "     <use transform=\"translate(137.071416 0)scale(0.996264)\" xlink:href=\"#CMR17-101\"/>\n",
       "     <use transform=\"translate(207.633043 0)scale(0.996264)\" xlink:href=\"#CMR17-61\"/>\n",
       "     <use transform=\"translate(279.347831 0)scale(0.996264)\" xlink:href=\"#CMR17-49\"/>\n",
       "     <use transform=\"translate(325.038308 0)scale(0.996264)\" xlink:href=\"#CMR17-46\"/>\n",
       "     <use transform=\"translate(349.909367 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "     <use transform=\"translate(425.67581 0)scale(0.996264)\" xlink:href=\"#CMR17-115\"/>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_14\">\n",
       "    <!-- k =0.5 (k-scheme) -->\n",
       "    <defs>\n",
       "     <path d=\"M 26.09375 26.234375 \n",
       "C 26 26.4375 25.5 27.03125 25.5 27.328125 \n",
       "C 25.5 27.53125 32.59375 33.984375 33.5 34.78125 \n",
       "C 39.203125 39.5625 42.796875 40.046875 45.40625 40.15625 \n",
       "L 45.40625 42.734375 \n",
       "C 44.796875 42.734375 44.59375 42.734375 44.5 42.640625 \n",
       "L 39.59375 42.53125 \n",
       "C 36.796875 42.53125 32.5 42.53125 29.796875 42.734375 \n",
       "L 29.796875 40.15625 \n",
       "C 31.203125 40.046875 32.203125 39.265625 32.203125 37.859375 \n",
       "C 32.203125 35.875 30.203125 33.984375 30.09375 33.984375 \n",
       "L 15 20.28125 \n",
       "L 15 69 \n",
       "L 3.09375 67.890625 \n",
       "L 3.09375 65.296875 \n",
       "C 9 65.296875 9.90625 64.703125 9.90625 59.921875 \n",
       "L 9.90625 6.859375 \n",
       "C 9.90625 3.09375 9.5 2.59375 3.09375 2.59375 \n",
       "L 3.09375 0 \n",
       "C 5.5 0.1875 9.90625 0.1875 12.40625 0.1875 \n",
       "C 14.90625 0.1875 19.296875 0.1875 21.703125 0 \n",
       "L 21.703125 2.59375 \n",
       "C 15.296875 2.59375 14.90625 2.984375 14.90625 6.859375 \n",
       "L 14.90625 17.796875 \n",
       "L 21.796875 24.0625 \n",
       "L 31.90625 9.15625 \n",
       "C 33.09375 7.359375 34.09375 5.96875 34.09375 4.671875 \n",
       "C 34.09375 2.890625 32.296875 2.59375 31.09375 2.59375 \n",
       "L 31.09375 0 \n",
       "C 33.5 0.1875 37.796875 0.1875 40.296875 0.1875 \n",
       "C 42.09375 0.1875 45.796875 0.09375 47.5 0 \n",
       "L 47.5 2.59375 \n",
       "C 42.796875 2.59375 41.703125 3.484375 38.703125 7.859375 \n",
       "z\n",
       "\" id=\"CMR17-107\"/>\n",
       "     <path d=\"M 11.40625 58.59375 \n",
       "C 12.40625 58.1875 16.5 56.890625 20.703125 56.890625 \n",
       "C 30 56.890625 35.09375 61.890625 38 64.6875 \n",
       "C 38 65.484375 38 66 37.40625 66 \n",
       "C 37.296875 66 37.09375 66 36.296875 65.59375 \n",
       "C 32.796875 64.09375 28.703125 63 23.703125 63 \n",
       "C 20.703125 63 16.203125 63.359375 11.296875 65.484375 \n",
       "C 10.203125 66 10 66 9.90625 66 \n",
       "C 9.40625 66 9.296875 65.890625 9.296875 63.90625 \n",
       "L 9.296875 34.859375 \n",
       "C 9.296875 33.015625 9.296875 32.5 10.296875 32.5 \n",
       "C 10.796875 32.5 11 32.703125 11.5 33.421875 \n",
       "C 14.703125 38.046875 19.09375 40 24.09375 40 \n",
       "C 27.59375 40 35.09375 37.734375 35.09375 20.203125 \n",
       "C 35.09375 16.984375 35.09375 11.1875 32.09375 6.59375 \n",
       "C 29.59375 2.484375 25.703125 0.390625 21.40625 0.390625 \n",
       "C 14.796875 0.390625 8.09375 4.984375 6.296875 12.6875 \n",
       "C 6.703125 12.59375 7.5 12.390625 7.90625 12.390625 \n",
       "C 9.203125 12.390625 11.703125 13.09375 11.703125 16.1875 \n",
       "C 11.703125 18.890625 9.796875 20 7.90625 20 \n",
       "C 5.59375 20 4.09375 18.59375 4.09375 15.796875 \n",
       "C 4.09375 7.09375 11 -2 21.59375 -2 \n",
       "C 31.90625 -2 41.703125 6.890625 41.703125 19.796875 \n",
       "C 41.703125 32.09375 33.90625 41.59375 24.203125 41.59375 \n",
       "C 19.09375 41.59375 14.796875 39.6875 11.40625 36 \n",
       "z\n",
       "\" id=\"CMR17-53\"/>\n",
       "     <path d=\"M 30.59375 -24.40625 \n",
       "C 30.59375 -24.3125 30.59375 -24.109375 30.296875 -23.8125 \n",
       "C 25.703125 -19.109375 13.40625 -6.296875 13.40625 24.9375 \n",
       "C 13.40625 56.171875 25.5 68.875 30.40625 73.890625 \n",
       "C 30.40625 73.984375 30.59375 74.1875 30.59375 74.484375 \n",
       "C 30.59375 74.796875 30.296875 75 29.90625 75 \n",
       "C 28.796875 75 20.296875 67.578125 15.40625 56.5625 \n",
       "C 10.40625 45.453125 9 34.65625 9 25.046875 \n",
       "C 9 17.828125 9.703125 5.625 15.703125 -7.296875 \n",
       "C 20.5 -17.703125 28.703125 -25 29.90625 -25 \n",
       "C 30.40625 -25 30.59375 -24.8125 30.59375 -24.40625 \n",
       "z\n",
       "\" id=\"CMR17-40\"/>\n",
       "     <path d=\"M 25.5 19.59375 \n",
       "L 25.5 24 \n",
       "L 0.40625 24 \n",
       "L 0.40625 19.59375 \n",
       "z\n",
       "\" id=\"CMR17-45\"/>\n",
       "     <path d=\"M 34.90625 35 \n",
       "C 33 35 30.203125 35 30.203125 31.484375 \n",
       "C 30.203125 28.6875 32.5 27.890625 33.796875 27.890625 \n",
       "C 34.5 27.890625 37.40625 28.1875 37.40625 31.6875 \n",
       "C 37.40625 38.6875 30.59375 44 22.90625 44 \n",
       "C 12.296875 44 3.296875 34.390625 3.296875 21.546875 \n",
       "C 3.296875 8.140625 12.703125 -1 22.90625 -1 \n",
       "C 35.296875 -1 38.40625 10.5625 38.40625 11.671875 \n",
       "C 38.40625 12.078125 38.296875 12.375 37.59375 12.375 \n",
       "C 36.90625 12.375 36.796875 12.28125 36.40625 10.96875 \n",
       "C 33.796875 2.8125 28.09375 0.796875 23.796875 0.796875 \n",
       "C 17.40625 0.796875 9.703125 6.734375 9.703125 21.640625 \n",
       "C 9.703125 36.84375 17.09375 42.1875 23 42.1875 \n",
       "C 26.90625 42.1875 32.703125 40.34375 34.90625 35 \n",
       "z\n",
       "\" id=\"CMR17-99\"/>\n",
       "     <path d=\"M 41.5 30.53125 \n",
       "C 41.5 35.65625 40.5 44 28.703125 44 \n",
       "C 20.5 44 16.5 37.375 15.296875 34.046875 \n",
       "L 15.203125 34.046875 \n",
       "L 15.203125 69 \n",
       "L 3.296875 67.890625 \n",
       "L 3.296875 65.296875 \n",
       "C 9.203125 65.296875 10.09375 64.703125 10.09375 60.046875 \n",
       "L 10.09375 6.921875 \n",
       "C 10.09375 3.09375 9.703125 2.59375 3.296875 2.59375 \n",
       "L 3.296875 0 \n",
       "C 5.703125 0.1875 10.09375 0.1875 12.703125 0.1875 \n",
       "C 15.296875 0.1875 19.796875 0.1875 22.203125 0 \n",
       "L 22.203125 2.59375 \n",
       "C 15.796875 2.59375 15.40625 3 15.40625 6.921875 \n",
       "L 15.40625 26.21875 \n",
       "C 15.40625 35.453125 21 42.390625 28 42.390625 \n",
       "C 35.40625 42.390625 36.203125 35.765625 36.203125 30.9375 \n",
       "L 36.203125 6.921875 \n",
       "C 36.203125 3.09375 35.796875 2.59375 29.40625 2.59375 \n",
       "L 29.40625 0 \n",
       "C 31.796875 0.1875 36.203125 0.1875 38.796875 0.1875 \n",
       "C 41.40625 0.1875 45.90625 0.1875 48.296875 0 \n",
       "L 48.296875 2.59375 \n",
       "C 41.90625 2.59375 41.5 3 41.5 6.921875 \n",
       "z\n",
       "\" id=\"CMR17-104\"/>\n",
       "     <path d=\"M 26.296875 24.9375 \n",
       "C 26.296875 32.140625 25.59375 44.359375 19.59375 57.265625 \n",
       "C 14.796875 67.6875 6.59375 75 5.40625 75 \n",
       "C 5.09375 75 4.703125 74.890625 4.703125 74.390625 \n",
       "C 4.703125 74.1875 4.796875 74.09375 4.90625 73.890625 \n",
       "C 9.703125 68.875 21.90625 56.171875 21.90625 25.046875 \n",
       "C 21.90625 -6.1875 9.796875 -18.90625 4.90625 -23.90625 \n",
       "C 4.796875 -24.109375 4.703125 -24.203125 4.703125 -24.40625 \n",
       "C 4.703125 -24.90625 5.09375 -25 5.40625 -25 \n",
       "C 6.5 -25 15 -17.609375 19.90625 -6.59375 \n",
       "C 24.90625 4.515625 26.296875 15.328125 26.296875 24.9375 \n",
       "z\n",
       "\" id=\"CMR17-41\"/>\n",
       "    </defs>\n",
       "    <g transform=\"translate(40 20.254175)scale(0.1 -0.1)\">\n",
       "     <use transform=\"scale(0.996264)\" xlink:href=\"#CMR17-107\"/>\n",
       "     <use transform=\"translate(78.368882 0)scale(0.996264)\" xlink:href=\"#CMR17-61\"/>\n",
       "     <use transform=\"translate(150.083671 0)scale(0.996264)\" xlink:href=\"#CMR17-48\"/>\n",
       "     <use transform=\"translate(195.774148 0)scale(0.996264)\" xlink:href=\"#CMR17-46\"/>\n",
       "     <use transform=\"translate(220.645206 0)scale(0.996264)\" xlink:href=\"#CMR17-53\"/>\n",
       "     <use transform=\"translate(296.41165 0)scale(0.996264)\" xlink:href=\"#CMR17-40\"/>\n",
       "     <use transform=\"translate(331.692417 0)scale(0.996264)\" xlink:href=\"#CMR17-107\"/>\n",
       "     <use transform=\"translate(379.985333 0)scale(0.996264)\" xlink:href=\"#CMR17-45\"/>\n",
       "     <use transform=\"translate(410.0613 0)scale(0.996264)\" xlink:href=\"#CMR17-115\"/>\n",
       "     <use transform=\"translate(445.862637 0)scale(0.996264)\" xlink:href=\"#CMR17-99\"/>\n",
       "     <use transform=\"translate(483.745844 0)scale(0.996264)\" xlink:href=\"#CMR17-104\"/>\n",
       "     <use transform=\"translate(534.641214 0)scale(0.996264)\" xlink:href=\"#CMR17-101\"/>\n",
       "     <use transform=\"translate(575.126874 0)scale(0.996264)\" xlink:href=\"#CMR17-109\"/>\n",
       "     <use transform=\"translate(652.046464 0)scale(0.996264)\" xlink:href=\"#CMR17-101\"/>\n",
       "     <use transform=\"translate(692.532124 0)scale(0.996264)\" xlink:href=\"#CMR17-41\"/>\n",
       "    </g>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"peffab07887\">\n",
       "   <rect height=\"161.16\" width=\"244.989921\" x=\"26.930079\" y=\"26.038498\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 600x450 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "\"\"\"\n",
    "Create Animation in Moving Reference Frame\n",
    "\"\"\"\n",
    "import matplotlib\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import matplotlib.animation as animation\n",
    "matplotlib.use(\"Agg\")\n",
    "fig, ax = plt.subplots(figsize=(4,3),dpi=150) \n",
    "ax.grid(True)\n",
    "f0 = sol[0]\n",
    "line0, = ax.plot(x[2:-2], f0[2:-2] ,'r-',linewidth=0.75, animated=True)\n",
    "line1, = ax.plot(x[2:-2], f0[2:-2] ,'k-o',markevery=2,markersize=3.5,markerfacecolor='deepskyblue',\n",
    "             markeredgewidth=0.25, markeredgecolor='k',linewidth=0.45, animated=True)\n",
    "\n",
    "ann = ax.annotate('time ='+str(round(t,3))+' s', xy=(2, 1), xytext=(40, 200),xycoords='figure points')\n",
    "ax.annotate('k ='+str(k) + ' (k-scheme)', xy=(2, 1), xytext=(40, 190),xycoords='figure points')\n",
    "plt.tight_layout()\n",
    "\n",
    "\n",
    "def animate_moving(i):\n",
    "    print('time=',i*dt)\n",
    "    t = i*dt\n",
    "    xt = x + i*1.1*c*dt\n",
    "    line0.set_xdata(xt[2:-2])\n",
    "    line1.set_xdata(xt[2:-2])    \n",
    "    ax.axes.set_xlim(xt[0],0.0*dx + xt[-1])\n",
    "    f = sol[i]\n",
    "    ax.axes.set_ylim(1.1*min(f) - 0.1,1.1*max(f))\n",
    "    ann.set_text('time ='+str(round(t,4))+'s (' + str(i)+ ').')\n",
    "    shift =int(np.ceil(i*c*dt/dx))\n",
    "    line1.set_ydata(np.roll(f[2:-2], -shift))\n",
    "\n",
    "    f0 = sol[0]\n",
    "    line0.set_ydata(f0[2:-2])\n",
    "    return line0,line1\n",
    "\n",
    "\n",
    "# Init only required for blitting to give a clean slate.\n",
    "def init():\n",
    "    line0.set_ydata(np.ma.array(x[2:-2], mask=True))\n",
    "    line1.set_ydata(np.ma.array(x[2:-2], mask=True))    \n",
    "    return line0,line1\n",
    "\n",
    "ani = animation.FuncAnimation(fig, animate_moving, np.arange(0,len(sol),2*int(1/cfl)), init_func=init,\n",
    "                              interval=20, blit=False)\n",
    "print('done!')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time= 0.0\n",
      "time= 0.0078125\n",
      "time= 0.015625\n",
      "time= 0.0234375\n",
      "time= 0.03125\n",
      "time= 0.0390625\n",
      "time= 0.046875\n",
      "time= 0.0546875\n",
      "time= 0.0625\n",
      "time= 0.0703125\n",
      "time= 0.078125\n",
      "time= 0.0859375\n",
      "time= 0.09375\n",
      "time= 0.1015625\n",
      "time= 0.109375\n",
      "time= 0.1171875\n",
      "time= 0.125\n",
      "time= 0.1328125\n",
      "time= 0.140625\n",
      "time= 0.1484375\n",
      "time= 0.15625\n",
      "time= 0.1640625\n",
      "time= 0.171875\n"
     ]
    },
    {
     "ename": "KeyboardInterrupt",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m                         Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-29-f14b34654064>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mani\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msave\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'__k-scheme_'\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mk\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0;34m'.mp4'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mfps\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m24\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mdpi\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m300\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/animation.py\u001b[0m in \u001b[0;36msave\u001b[0;34m(self, filename, writer, fps, dpi, codec, bitrate, extra_args, metadata, extra_anim, savefig_kwargs)\u001b[0m\n\u001b[1;32m   1172\u001b[0m                         \u001b[0;31m# TODO: See if turning off blit is really necessary\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1173\u001b[0m                         \u001b[0manim\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_draw_next_frame\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0md\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mblit\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1174\u001b[0;31m                     \u001b[0mwriter\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgrab_frame\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0msavefig_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1175\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1176\u001b[0m         \u001b[0;31m# Reconnect signal for first draw if necessary\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/animation.py\u001b[0m in \u001b[0;36mgrab_frame\u001b[0;34m(self, **savefig_kwargs)\u001b[0m\n\u001b[1;32m    374\u001b[0m             \u001b[0;31m# frame format and dpi.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    375\u001b[0m             self.fig.savefig(self._frame_sink(), format=self.frame_format,\n\u001b[0;32m--> 376\u001b[0;31m                              dpi=self.dpi, **savefig_kwargs)\n\u001b[0m\u001b[1;32m    377\u001b[0m         \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mRuntimeError\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mIOError\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    378\u001b[0m             \u001b[0mout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_proc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcommunicate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/figure.py\u001b[0m in \u001b[0;36msavefig\u001b[0;34m(self, fname, frameon, transparent, **kwargs)\u001b[0m\n\u001b[1;32m   2092\u001b[0m             \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mset_frameon\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mframeon\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2093\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2094\u001b[0;31m         \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcanvas\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprint_figure\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   2095\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2096\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0mframeon\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/backend_bases.py\u001b[0m in \u001b[0;36mprint_figure\u001b[0;34m(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, **kwargs)\u001b[0m\n\u001b[1;32m   2073\u001b[0m                     \u001b[0morientation\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0morientation\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2074\u001b[0m                     \u001b[0mbbox_inches_restore\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0m_bbox_inches_restore\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2075\u001b[0;31m                     **kwargs)\n\u001b[0m\u001b[1;32m   2076\u001b[0m             \u001b[0;32mfinally\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2077\u001b[0m                 \u001b[0;32mif\u001b[0m \u001b[0mbbox_inches\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mrestore_bbox\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py\u001b[0m in \u001b[0;36mprint_raw\u001b[0;34m(self, filename_or_obj, *args, **kwargs)\u001b[0m\n\u001b[1;32m    459\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    460\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0mprint_raw\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilename_or_obj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 461\u001b[0;31m         \u001b[0mFigureCanvasAgg\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdraw\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    462\u001b[0m         \u001b[0mrenderer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_renderer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    463\u001b[0m         \u001b[0;32mwith\u001b[0m \u001b[0mcbook\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_setattr_cm\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrenderer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdpi\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfigure\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdpi\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;31m \u001b[0m\u001b[0;31m\\\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py\u001b[0m in \u001b[0;36mdraw\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m    400\u001b[0m         \u001b[0mtoolbar\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtoolbar\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    401\u001b[0m         \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 402\u001b[0;31m             \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfigure\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdraw\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrenderer\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    403\u001b[0m             \u001b[0;31m# A GUI class may be need to update a window using this draw, so\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    404\u001b[0m             \u001b[0;31m# don't forget to call the superclass.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/artist.py\u001b[0m in \u001b[0;36mdraw_wrapper\u001b[0;34m(artist, renderer, *args, **kwargs)\u001b[0m\n\u001b[1;32m     48\u001b[0m                 \u001b[0mrenderer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstart_filter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     49\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 50\u001b[0;31m             \u001b[0;32mreturn\u001b[0m \u001b[0mdraw\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0martist\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrenderer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     51\u001b[0m         \u001b[0;32mfinally\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     52\u001b[0m             \u001b[0;32mif\u001b[0m \u001b[0martist\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_agg_filter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/figure.py\u001b[0m in \u001b[0;36mdraw\u001b[0;34m(self, renderer)\u001b[0m\n\u001b[1;32m   1647\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1648\u001b[0m             mimage._draw_list_compositing_images(\n\u001b[0;32m-> 1649\u001b[0;31m                 renderer, self, artists, self.suppressComposite)\n\u001b[0m\u001b[1;32m   1650\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1651\u001b[0m             \u001b[0mrenderer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclose_group\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'figure'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/image.py\u001b[0m in \u001b[0;36m_draw_list_compositing_images\u001b[0;34m(renderer, parent, artists, suppress_composite)\u001b[0m\n\u001b[1;32m    136\u001b[0m     \u001b[0;32mif\u001b[0m \u001b[0mnot_composite\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mhas_images\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    137\u001b[0m         \u001b[0;32mfor\u001b[0m \u001b[0ma\u001b[0m \u001b[0;32min\u001b[0m \u001b[0martists\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 138\u001b[0;31m             \u001b[0ma\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdraw\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrenderer\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    139\u001b[0m     \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    140\u001b[0m         \u001b[0;31m# Composite any adjacent images together\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/artist.py\u001b[0m in \u001b[0;36mdraw_wrapper\u001b[0;34m(artist, renderer, *args, **kwargs)\u001b[0m\n\u001b[1;32m     48\u001b[0m                 \u001b[0mrenderer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstart_filter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     49\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 50\u001b[0;31m             \u001b[0;32mreturn\u001b[0m \u001b[0mdraw\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0martist\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrenderer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     51\u001b[0m         \u001b[0;32mfinally\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     52\u001b[0m             \u001b[0;32mif\u001b[0m \u001b[0martist\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_agg_filter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/axes/_base.py\u001b[0m in \u001b[0;36mdraw\u001b[0;34m(self, renderer, inframe)\u001b[0m\n\u001b[1;32m   2626\u001b[0m             \u001b[0mrenderer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstop_rasterizing\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2627\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2628\u001b[0;31m         \u001b[0mmimage\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_draw_list_compositing_images\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrenderer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0martists\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   2629\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2630\u001b[0m         \u001b[0mrenderer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclose_group\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'axes'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/image.py\u001b[0m in \u001b[0;36m_draw_list_compositing_images\u001b[0;34m(renderer, parent, artists, suppress_composite)\u001b[0m\n\u001b[1;32m    136\u001b[0m     \u001b[0;32mif\u001b[0m \u001b[0mnot_composite\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mhas_images\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    137\u001b[0m         \u001b[0;32mfor\u001b[0m \u001b[0ma\u001b[0m \u001b[0;32min\u001b[0m \u001b[0martists\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 138\u001b[0;31m             \u001b[0ma\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdraw\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrenderer\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    139\u001b[0m     \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    140\u001b[0m         \u001b[0;31m# Composite any adjacent images together\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/artist.py\u001b[0m in \u001b[0;36mdraw_wrapper\u001b[0;34m(artist, renderer, *args, **kwargs)\u001b[0m\n\u001b[1;32m     48\u001b[0m                 \u001b[0mrenderer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstart_filter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     49\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 50\u001b[0;31m             \u001b[0;32mreturn\u001b[0m \u001b[0mdraw\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0martist\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrenderer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     51\u001b[0m         \u001b[0;32mfinally\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     52\u001b[0m             \u001b[0;32mif\u001b[0m \u001b[0martist\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_agg_filter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/text.py\u001b[0m in \u001b[0;36mdraw\u001b[0;34m(self, renderer)\u001b[0m\n\u001b[1;32m   2391\u001b[0m         \u001b[0;31m# Draw text, including FancyBboxPatch, after FancyArrowPatch.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2392\u001b[0m         \u001b[0;31m# Otherwise, a wedge arrowstyle can land partly on top of the Bbox.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2393\u001b[0;31m         \u001b[0mText\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdraw\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrenderer\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   2394\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2395\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0mget_window_extent\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrenderer\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/artist.py\u001b[0m in \u001b[0;36mdraw_wrapper\u001b[0;34m(artist, renderer, *args, **kwargs)\u001b[0m\n\u001b[1;32m     48\u001b[0m                 \u001b[0mrenderer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstart_filter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     49\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 50\u001b[0;31m             \u001b[0;32mreturn\u001b[0m \u001b[0mdraw\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0martist\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrenderer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     51\u001b[0m         \u001b[0;32mfinally\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     52\u001b[0m             \u001b[0;32mif\u001b[0m \u001b[0martist\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_agg_filter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/text.py\u001b[0m in \u001b[0;36mdraw\u001b[0;34m(self, renderer)\u001b[0m\n\u001b[1;32m    752\u001b[0m                     textrenderer.draw_tex(gc, x, y, clean_line,\n\u001b[1;32m    753\u001b[0m                                           \u001b[0mtextobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_fontproperties\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mangle\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 754\u001b[0;31m                                           mtext=mtext)\n\u001b[0m\u001b[1;32m    755\u001b[0m                 \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    756\u001b[0m                     textrenderer.draw_text(gc, x, y, clean_line,\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py\u001b[0m in \u001b[0;36mdraw_tex\u001b[0;34m(self, gc, x, y, s, prop, angle, ismath, mtext)\u001b[0m\n\u001b[1;32m    231\u001b[0m         \u001b[0mtexmanager\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_texmanager\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    232\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 233\u001b[0;31m         \u001b[0mZ\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtexmanager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_grey\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ms\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msize\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdpi\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    234\u001b[0m         \u001b[0mZ\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mZ\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0;36m255.0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0muint8\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    235\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/texmanager.py\u001b[0m in \u001b[0;36mget_grey\u001b[0;34m(self, tex, fontsize, dpi)\u001b[0m\n\u001b[1;32m    418\u001b[0m         \u001b[0malpha\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgrey_arrayd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    419\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0malpha\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 420\u001b[0;31m             \u001b[0mpngfile\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmake_png\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtex\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfontsize\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdpi\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    421\u001b[0m             \u001b[0mX\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_png\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_png\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtexcache\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpngfile\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    422\u001b[0m             \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgrey_arrayd\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0malpha\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mX\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m:\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/texmanager.py\u001b[0m in \u001b[0;36mmake_png\u001b[0;34m(self, tex, fontsize, dpi)\u001b[0m\n\u001b[1;32m    383\u001b[0m             self._run_checked_subprocess(\n\u001b[1;32m    384\u001b[0m                 [\"dvipng\", \"-bg\", \"Transparent\", \"-D\", str(dpi),\n\u001b[0;32m--> 385\u001b[0;31m                  \"-T\", \"tight\", \"-o\", pngfile, dvifile], tex)\n\u001b[0m\u001b[1;32m    386\u001b[0m         \u001b[0;32mreturn\u001b[0m \u001b[0mpngfile\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    387\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/site-packages/matplotlib/texmanager.py\u001b[0m in \u001b[0;36m_run_checked_subprocess\u001b[0;34m(self, command, tex)\u001b[0m\n\u001b[1;32m    296\u001b[0m             report = subprocess.check_output(command,\n\u001b[1;32m    297\u001b[0m                                              \u001b[0mcwd\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtexcache\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 298\u001b[0;31m                                              stderr=subprocess.STDOUT)\n\u001b[0m\u001b[1;32m    299\u001b[0m         \u001b[0;32mexcept\u001b[0m \u001b[0msubprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mCalledProcessError\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mexc\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    300\u001b[0m             raise RuntimeError(\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/subprocess.py\u001b[0m in \u001b[0;36mcheck_output\u001b[0;34m(timeout, *popenargs, **kwargs)\u001b[0m\n\u001b[1;32m    354\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    355\u001b[0m     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,\n\u001b[0;32m--> 356\u001b[0;31m                **kwargs).stdout\n\u001b[0m\u001b[1;32m    357\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    358\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/subprocess.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(input, timeout, check, *popenargs, **kwargs)\u001b[0m\n\u001b[1;32m    423\u001b[0m     \u001b[0;32mwith\u001b[0m \u001b[0mPopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mpopenargs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mprocess\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    424\u001b[0m         \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 425\u001b[0;31m             \u001b[0mstdout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstderr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcommunicate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    426\u001b[0m         \u001b[0;32mexcept\u001b[0m \u001b[0mTimeoutExpired\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    427\u001b[0m             \u001b[0mprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkill\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/lib/python3.6/subprocess.py\u001b[0m in \u001b[0;36mcommunicate\u001b[0;34m(self, input, timeout)\u001b[0m\n\u001b[1;32m    848\u001b[0m                 \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_stdin_write\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    849\u001b[0m             \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstdout\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 850\u001b[0;31m                 \u001b[0mstdout\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstdout\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    851\u001b[0m                 \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstdout\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclose\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    852\u001b[0m             \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstderr\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
     ]
    }
   ],
   "source": [
    "ani.save('__k-scheme_' + str(k)+'.mp4',fps=24,dpi=300)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "CSS style adapted from https://github.com/barbagroup/CFDPython. Copyright (c) Barba group\n",
       "<link href='http://fonts.googleapis.com/css?family=Merriweather' rel='stylesheet' type='text/css'>\n",
       "<link href='http://fonts.googleapis.com/css?family=Bitter' rel='stylesheet' type='text/css'>\n",
       "<link href='http://fonts.googleapis.com/css?family=Oxygen' rel='stylesheet' type='text/css'>\n",
       "<link href='http://fonts.googleapis.com/css?family=Lora' rel='stylesheet' type='text/css'>\n",
       "<link href='http://fonts.googleapis.com/css?family=Fenix' rel='stylesheet' type='text/css'>\n",
       "<link href='http://fonts.googleapis.com/css?family=Alegreya+Sans:100,300,400,500,700,800,900,100italic,300italic,400italic,500italic,700italic,800italic,900italic' rel='stylesheet' type='text/css'>\n",
       "<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro:300,400' rel='stylesheet' type='text/css'>\n",
       "\n",
       "<style>\n",
       "    @font-face {\n",
       "        font-family: \"Computer Modern\";\n",
       "        src: url('http://mirrors.ctan.org/fonts/cm-unicode/fonts/otf/cmunss.otf');\n",
       "    }\n",
       "\n",
       "    /*div.cell{\n",
       "        width:800px;\n",
       "        margin-left:16% !important;\n",
       "        margin-right:auto;\n",
       "    } */\n",
       "\n",
       "    /* set the font size in tables */\n",
       "    tr, td, th{\n",
       "        font-size:110%;\n",
       "    }\n",
       "\n",
       "    /* spec for headers */\n",
       "    h1 {\n",
       "        font-family: 'Bitter', serif;\n",
       "    }\n",
       "\n",
       "    h2 {\n",
       "        font-family: 'Fenix', serif;\n",
       "    }\n",
       "    \n",
       "    h3{\n",
       "        font-family: 'Fenix', serif;\n",
       "        margin-top:12px;\n",
       "        margin-bottom: 3px;\n",
       "    }\n",
       "\n",
       "    h4{\n",
       "        font-family: 'Fenix', serif;\n",
       "    }\n",
       "\n",
       "    h5 {\n",
       "        font-family: 'Alegreya Sans', sans-serif;\n",
       "    }\n",
       "\n",
       "    div.text_cell_render{\n",
       "        font-family: 'Merriweather','Alegreya Sans','Lora', 'Oxygen', \"Helvetica Neue\", Arial, Helvetica, Geneva, sans-serif;\n",
       "        line-height: 160%;\n",
       "        font-size: 130%;\n",
       "    }\n",
       "\n",
       "    .CodeMirror{\n",
       "        font-family: \"Source Code Pro\";\n",
       "        font-size: 100%;\n",
       "    }\n",
       "\n",
       "    .text_cell_render h1 {\n",
       "        font-weight: 200;\n",
       "        font-size: 32pt;\n",
       "        line-height: 120%;\n",
       "        color:#CD2305;\n",
       "        margin-bottom: 0.5em;\n",
       "        margin-top: 0.5em;\n",
       "        display: block;\n",
       "    }\n",
       "\n",
       "    .text_cell_render h2 {\n",
       "        font-size: 26pt;\n",
       "        text-align: center;\n",
       "    }\n",
       "\n",
       "    .text_cell_render h3 {\n",
       "        font-size: 20pt;\n",
       "    }\n",
       "\n",
       "    .text_cell_render h4 {\n",
       "        font-size: 18pt;\n",
       "    }\n",
       "\n",
       "    .text_cell_render h5 {\n",
       "        font-weight: 300;\n",
       "        font-size: 16pt;\n",
       "        color: #CD2305;\n",
       "        font-style: italic;\n",
       "        margin-bottom: .5em;\n",
       "        margin-top: 0.5em;\n",
       "        display: block;\n",
       "    }\n",
       "    \n",
       "    .warning{\n",
       "        color: rgb( 240, 20, 20 )\n",
       "    }  \n",
       "\n",
       "/*  div#notebook {background-color: #1e1e1e; border-top: none;}\n",
       "    div#notebook-container {background-color: rgb(180, 180, 180);}\n",
       " */\n",
       "\n",
       "</style>\n",
       "\n",
       "<script>\n",
       "    MathJax.Hub.Config({\n",
       "                TeX: {\n",
       "                    extensions: [\"AMSmath.js\"]\n",
       "                },\n",
       "                tex2jax: {\n",
       "                    inlineMath: [ ['$','$'], [\"\\\\(\",\"\\\\)\"] ],\n",
       "                    displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"] ]\n",
       "                },\n",
       "                displayAlign: 'center', // Change this to 'center' to center equations.\n",
       "                \"HTML-CSS\": {\n",
       "                    availableFonts: [\"TeX\"],\n",
       "                    scale: 100,\n",
       "                    styles: {'.MathJax_Display': {\"margin\": 4}}\n",
       "                }\n",
       "        });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import urllib\n",
    "import requests\n",
    "from IPython.core.display import HTML\n",
    "def css_styling():\n",
    "    styles = requests.get(\"https://raw.githubusercontent.com/saadtony/NumericalMethods/master/styles/custom.css\")\n",
    "    return HTML(styles.text)\n",
    "css_styling()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
